You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/actions/creating-actions/creating-a-javascript-action.md
+8-8Lines changed: 8 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -48,21 +48,21 @@ Before you begin, you'll need to download Node.js and create a public {% data va
48
48
49
49
1. From your terminal, change directories into your new repository.
50
50
51
-
```shell
51
+
```shell{:copy}
52
52
cd hello-world-javascript-action
53
53
```
54
54
55
55
1. From your terminal, initialize the directory with npm to generate a `package.json` file.
56
56
57
-
```shell
57
+
```shell{:copy}
58
58
npm init -y
59
59
```
60
60
61
61
## Creating an action metadata file
62
62
63
63
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)."
64
64
65
-
```yaml
65
+
```yaml{:copy}
66
66
name: 'Hello World'
67
67
description: 'Greet someone and record the time'
68
68
inputs:
@@ -92,7 +92,7 @@ The toolkit offers more than the `core` and `github` packages. For more informat
92
92
93
93
At your terminal, install the actions toolkit `core` and `github` packages.
94
94
95
-
```shell
95
+
```shell{:copy}
96
96
npm install @actions/core
97
97
npm install @actions/github
98
98
```
@@ -108,7 +108,7 @@ GitHub Actions provide context information about the webhook event, Git refs, wo
108
108
Add a new file called `index.js`, with the following code.
109
109
110
110
{% raw %}
111
-
```javascript
111
+
```javascript{:copy}
112
112
const core = require('@actions/core');
113
113
const github = require('@actions/github');
114
114
@@ -174,7 +174,7 @@ From your terminal, commit your `action.yml`, `index.js`, `node_modules`, `packa
174
174
175
175
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)."
@@ -219,7 +219,7 @@ This example demonstrates how your new public action can be run from within an e
219
219
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.
220
220
221
221
{% raw %}
222
-
```yaml
222
+
```yaml{:copy}
223
223
on: [push]
224
224
225
225
jobs:
@@ -246,7 +246,7 @@ Copy the workflow code into a `.github/workflows/main.yml` file in your action's
0 commit comments