-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add changes for v1 and documentation
- Loading branch information
Unai Abrisketa
committed
May 9, 2022
1 parent
8c4869a
commit f49d0b7
Showing
2 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,25 @@ | ||
## action-node-run | ||
GitHub composite action(s) aimed to run node commands | ||
# action-node-run | ||
|
||
GitHub Action for installing Node/Yarn packages on development environment and running commands. It caches dependencies for reduced execution times. | ||
|
||
## Inputs | ||
|
||
| Name | Description | Default | Required | | ||
| -------------- | --------------------------------------------------------- | ------- | -------- | | ||
| `node_version` | The node version to be used. | `18` | `true` | | ||
| `cache_key` | The cache key to be checked. Can be one of `npm`, `yarn`. | `yarn` | `true` | | ||
| `cmd` | The command to be executed. | `nil` | `true` | | ||
|
||
## Usage | ||
|
||
```yml | ||
jobs: | ||
eslint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: ePages-de/action-node-run@v1 | ||
with: | ||
node_version: 18 | ||
cache_key: yarn | ||
cmd: npx eslint | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Run Node/Yarn | ||
description: Install Node/Yarn packages on development environment and run commands. | ||
author: Manel Merino <[email protected]>, Roberto Welzel Filho <[email protected]>, Unai Abrisketa <[email protected]> | ||
|
||
inputs: | ||
node_version: | ||
description: The node version to be used. Defaults to `18`. | ||
required: true | ||
default: '18' | ||
cache_key: | ||
description: The cache key to be checked. Can be one of `npm`, `yarn`. Defaults to `yarn`. | ||
required: true | ||
default: yarn | ||
cmd: | ||
description: The command to be executed. | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-node@v3 | ||
with: | ||
node-version: ${{ inputs.node_version }} | ||
cache: ${{ inputs.cache_key }} | ||
- shell: bash | ||
run: | | ||
if [ "${{ inputs.cache_key }}" -eq 'npm' ]; then | ||
npm install --production=false | ||
else | ||
yarn install --production=false | ||
fi | ||
- shell: bash | ||
run: ${{ inputs.cmd }} |