mirror of
https://github.com/actions/javascript-action.git
synced 2025-12-11 13:20:32 +00:00
Update README.md to reflect GitHub Action usage and improve Node.js setup instructions
This commit is contained in:
33
README.md
33
README.md
@@ -1,7 +1,10 @@
|
|||||||
# Create a JavaScript Action
|
# Create a GitHub Action Using JavaScript
|
||||||
|
|
||||||
[](https://github.com/super-linter/super-linter)
|
[](https://github.com/super-linter/super-linter)
|
||||||

|

|
||||||
|
[](https://github.com/actions/javascript-action/actions/workflows/check-dist.yml)
|
||||||
|
[](https://github.com/actions/javascript-action/actions/workflows/codeql-analysis.yml)
|
||||||
|
[](./badges/coverage.svg)
|
||||||
|
|
||||||
Use this template to bootstrap the creation of a JavaScript action. :rocket:
|
Use this template to bootstrap the creation of a JavaScript action. :rocket:
|
||||||
|
|
||||||
@@ -36,11 +39,13 @@ need to perform some initial setup steps before you can develop your action.
|
|||||||
> [!NOTE]
|
> [!NOTE]
|
||||||
>
|
>
|
||||||
> You'll need to have a reasonably modern version of
|
> You'll need to have a reasonably modern version of
|
||||||
> [Node.js](https://nodejs.org) handy. If you are using a version manager like
|
> [Node.js](https://nodejs.org) handy (20.x or later should work!). If you are
|
||||||
> [`nodenv`](https://github.com/nodenv/nodenv) or
|
> using a version manager like [`nodenv`](https://github.com/nodenv/nodenv) or
|
||||||
> [`nvm`](https://github.com/nvm-sh/nvm), you can run `nodenv install` in the
|
> [`fnm`](https://github.com/Schniz/fnm), this template has a `.node-version`
|
||||||
> root of your repository to install the version specified in
|
> file at the root of the repository that can be used to automatically switch to
|
||||||
> [`package.json`](./package.json). Otherwise, 20.x or later should work!
|
> the correct version when you `cd` into the repository. Additionally, this
|
||||||
|
> `.node-version` file is used by GitHub Actions in any `actions/setup-node`
|
||||||
|
> actions.
|
||||||
|
|
||||||
1. :hammer_and_wrench: Install the dependencies
|
1. :hammer_and_wrench: Install the dependencies
|
||||||
|
|
||||||
@@ -119,12 +124,10 @@ So, what are you waiting for? Go ahead and start customizing your action!
|
|||||||
npm run all
|
npm run all
|
||||||
```
|
```
|
||||||
|
|
||||||
> This step is important! It will run [`ncc`](https://github.com/vercel/ncc)
|
> This step is important! It will run [`rollup`](https://rollupjs.org/) to
|
||||||
> to build the final JavaScript action code with all dependencies included.
|
> build the final JavaScript action code with all dependencies included. If
|
||||||
> If you do not run this step, your action will not work correctly when it is
|
> you do not run this step, your action will not work correctly when it is
|
||||||
> used in a workflow. This step also includes the `--license` option for
|
> used in a workflow.
|
||||||
> `ncc`, which will create a license file for all of the production node
|
|
||||||
> modules used in your project.
|
|
||||||
|
|
||||||
1. (Optional) Test your action locally
|
1. (Optional) Test your action locally
|
||||||
|
|
||||||
@@ -218,15 +221,15 @@ steps:
|
|||||||
id: checkout
|
id: checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Run my Action
|
- name: Test Local Action
|
||||||
id: run-action
|
id: test-action
|
||||||
uses: actions/javascript-action@v1 # Commit with the `v1` tag
|
uses: actions/javascript-action@v1 # Commit with the `v1` tag
|
||||||
with:
|
with:
|
||||||
milliseconds: 1000
|
milliseconds: 1000
|
||||||
|
|
||||||
- name: Print Output
|
- name: Print Output
|
||||||
id: output
|
id: output
|
||||||
run: echo "${{ steps.run-action.outputs.time }}"
|
run: echo "${{ steps.test-action.outputs.time }}"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Dependency License Management
|
## Dependency License Management
|
||||||
|
|||||||
Reference in New Issue
Block a user