Skip to content

Commit 42bc0d5

Browse files
authored
Adds option to copy content from code blocks (#22829)
1 parent 92b8d62 commit 42bc0d5

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

content/actions/creating-actions/creating-a-javascript-action.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,21 +48,21 @@ Before you begin, you'll need to download Node.js and create a public {% data va
4848

4949
1. From your terminal, change directories into your new repository.
5050

51-
```shell
51+
```shell{:copy}
5252
cd hello-world-javascript-action
5353
```
5454

5555
1. From your terminal, initialize the directory with npm to generate a `package.json` file.
5656

57-
```shell
57+
```shell{:copy}
5858
npm init -y
5959
```
6060

6161
## Creating an action metadata file
6262

6363
Create a new file named `action.yml` in the `hello-world-javascript-action` directory with the following example code. For more information, see "[Metadata syntax for {% data variables.product.prodname_actions %}](/actions/creating-actions/metadata-syntax-for-github-actions)."
6464

65-
```yaml
65+
```yaml{:copy}
6666
name: 'Hello World'
6767
description: 'Greet someone and record the time'
6868
inputs:
@@ -92,7 +92,7 @@ The toolkit offers more than the `core` and `github` packages. For more informat
9292

9393
At your terminal, install the actions toolkit `core` and `github` packages.
9494

95-
```shell
95+
```shell{:copy}
9696
npm install @actions/core
9797
npm install @actions/github
9898
```
@@ -108,7 +108,7 @@ GitHub Actions provide context information about the webhook event, Git refs, wo
108108
Add a new file called `index.js`, with the following code.
109109

110110
{% raw %}
111-
```javascript
111+
```javascript{:copy}
112112
const core = require('@actions/core');
113113
const github = require('@actions/github');
114114
@@ -174,7 +174,7 @@ From your terminal, commit your `action.yml`, `index.js`, `node_modules`, `packa
174174

175175
It's best practice to also add a version tag for releases of your action. For more information on versioning your action, see "[About actions](/actions/automating-your-workflow-with-github-actions/about-actions#using-release-management-for-actions)."
176176

177-
```shell
177+
```shell{:copy}
178178
git add action.yml index.js node_modules/* package.json package-lock.json README.md
179179
git commit -m "My first action is ready"
180180
git tag -a -m "My first action release" v1.1
@@ -219,7 +219,7 @@ This example demonstrates how your new public action can be run from within an e
219219
Copy the following YAML into a new file at `.github/workflows/main.yml`, and update the `uses: octocat/hello-world-javascript-action@v1.1` line with your username and the name of the public repository you created above. You can also replace the `who-to-greet` input with your name.
220220

221221
{% raw %}
222-
```yaml
222+
```yaml{:copy}
223223
on: [push]
224224
225225
jobs:
@@ -246,7 +246,7 @@ Copy the workflow code into a `.github/workflows/main.yml` file in your action's
246246

247247
{% raw %}
248248
**.github/workflows/main.yml**
249-
```yaml
249+
```yaml{:copy}
250250
on: [push]
251251
252252
jobs:

0 commit comments

Comments
 (0)