55
66Use this template to bootstrap the creation of a JavaScript action. :rocket :
77
8- This template includes compilation support, tests, a validation workflow,
9- publishing, and versioning guidance.
8+ This template includes compilation support, tests, a validation workflow, publishing, and versioning
9+ guidance.
1010
1111If you are new, there's also a simpler introduction in the
1212[ Hello world JavaScript action repository] ( https://github.com/actions/hello-world-javascript-action ) .
1313
1414## Create Your Own Action
1515
16- To create your own action, you can use this repository as a template! Just
17- follow the below instructions:
16+ To create your own action, you can use this repository as a template! Just follow the below
17+ instructions:
1818
19191 . Click the ** Use this template** button at the top of the repository
20201 . Select ** Create a new repository**
@@ -24,23 +24,22 @@ follow the below instructions:
2424
2525> [ !IMPORTANT]
2626>
27- > Make sure to remove or update the [ ` CODEOWNERS ` ] ( ./CODEOWNERS ) file! For
28- > details on how to use this file, see
27+ > Make sure to remove or update the [ ` CODEOWNERS ` ] ( ./CODEOWNERS ) file! For details on how to use
28+ > this file, see
2929> [ About code owners] ( https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners ) .
3030
3131## Initial Setup
3232
33- After you've cloned the repository to your local machine or codespace, you'll
34- need to perform some initial setup steps before you can develop your action.
33+ After you've cloned the repository to your local machine or codespace, you'll need to perform some
34+ initial setup steps before you can develop your action.
3535
3636> [ !NOTE]
3737>
38- > You'll need to have a reasonably modern version of
39- > [ Node.js] ( https://nodejs.org ) handy. If you are using a version manager like
40- > [ ` nodenv ` ] ( https://github.com/nodenv/nodenv ) or
41- > [ ` nvm ` ] ( https://github.com/nvm-sh/nvm ) , you can run ` nodenv install ` in the
42- > root of your repository to install the version specified in
43- > [ ` package.json ` ] ( ./package.json ) . Otherwise, 20.x or later should work!
38+ > You'll need to have a reasonably modern version of [ Node.js] ( https://nodejs.org ) handy. If you are
39+ > using a version manager like [ ` nodenv ` ] ( https://github.com/nodenv/nodenv ) or
40+ > [ ` nvm ` ] ( https://github.com/nvm-sh/nvm ) , you can run ` nodenv install ` in the root of your
41+ > repository to install the version specified in [ ` package.json ` ] ( ./package.json ) . Otherwise, 20.x
42+ > or later should work!
4443
45441 . :hammer_and_wrench : Install the dependencies
4645
@@ -69,23 +68,23 @@ need to perform some initial setup steps before you can develop your action.
6968
7069## Update the Action Metadata
7170
72- The [ ` action.yml ` ] ( action.yml ) file defines metadata about your action, such as
73- input(s) and output(s). For details about this file, see
71+ The [ ` action.yml ` ] ( action.yml ) file defines metadata about your action, such as input(s) and
72+ output(s). For details about this file, see
7473[ Metadata syntax for GitHub Actions] ( https://docs.github.com/en/actions/creating-actions/metadata-syntax-for-github-actions ) .
7574
76- When you copy this repository, update ` action.yml ` with the name, description,
77- inputs, and outputs for your action.
75+ When you copy this repository, update ` action.yml ` with the name, description, inputs, and outputs
76+ for your action.
7877
7978## Update the Action Code
8079
81- The [ ` src/ ` ] ( ./src/ ) directory is the heart of your action! This contains the
82- source code that will be run when your action is invoked. You can replace the
83- contents of this directory with your own code.
80+ The [ ` src/ ` ] ( ./src/ ) directory is the heart of your action! This contains the source code that will
81+ be run when your action is invoked. You can replace the contents of this directory with your own
82+ code.
8483
8584There are a few things to keep in mind when writing your action code:
8685
87- - Most GitHub Actions toolkit and CI/CD operations are processed asynchronously.
88- In ` main.js ` , you will see that the action is run in an ` async ` function.
86+ - Most GitHub Actions toolkit and CI/CD operations are processed asynchronously. In ` main.js ` , you
87+ will see that the action is run in an ` async ` function.
8988
9089 ``` javascript
9190 const core = require (' @actions/core' );
@@ -121,12 +120,11 @@ So, what are you waiting for? Go ahead and start customizing your action!
121120
122121 > [ !WARNING]
123122 >
124- > This step is important! It will run [ ` ncc ` ] ( https://github.com/vercel/ncc )
125- > to build the final JavaScript action code with all dependencies included.
126- > If you do not run this step, your action will not work correctly when it is
127- > used in a workflow. This step also includes the ` --license ` option for
128- > ` ncc ` , which will create a license file for all of the production node
129- > modules used in your project.
123+ > This step is important! It will run [ ` ncc ` ] ( https://github.com/vercel/ncc ) to build the final
124+ > JavaScript action code with all dependencies included. If you do not run this step, your action
125+ > will not work correctly when it is used in a workflow. This step also includes the ` --license `
126+ > option for ` ncc ` , which will create a license file for all of the production node modules used
127+ > in your project.
130128
1311291 . Commit your changes
132130
@@ -147,14 +145,14 @@ So, what are you waiting for? Go ahead and start customizing your action!
147145Your action is now published! :rocket :
148146
149147For information about versioning your action, see
150- [ Versioning] ( https://github.com/actions/toolkit/blob/main/docs/action-versioning.md )
151- in the GitHub Actions toolkit.
148+ [ Versioning] ( https://github.com/actions/toolkit/blob/main/docs/action-versioning.md ) in the GitHub
149+ Actions toolkit.
152150
153151## Validate the Action
154152
155- You can now validate the action by referencing it in a workflow file. For
156- example, [ ` ci.yml ` ] ( ./.github/workflows/ci.yml ) demonstrates how to reference an
157- action in the same repository.
153+ You can now validate the action by referencing it in a workflow file. For example,
154+ [ ` ci.yml ` ] ( ./.github/workflows/ci.yml ) demonstrates how to reference an action in the same
155+ repository.
158156
159157``` yaml
160158steps :
@@ -178,14 +176,13 @@ For example workflow runs, check out the
178176
179177## Usage
180178
181- After testing, you can create version tag(s) that developers can use to
182- reference different stable versions of your action. For more information, see
183- [Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md)
184- in the GitHub Actions toolkit.
179+ After testing, you can create version tag(s) that developers can use to reference different stable
180+ versions of your action. For more information, see
181+ [Versioning](https://github.com/actions/toolkit/blob/main/docs/action-versioning.md) in the GitHub
182+ Actions toolkit.
185183
186- To include the action in a workflow in another repository, you can use the
187- ` uses` syntax with the `@` symbol to reference a specific branch, tag, or commit
188- hash.
184+ To include the action in a workflow in another repository, you can use the ` uses` syntax with the
185+ ` @` symbol to reference a specific branch, tag, or commit hash.
189186
190187` ` ` yaml
191188steps:
0 commit comments