Skip to content

Commit f49d0b7

Browse files
author
Unai Abrisketa
committed
Add changes for v1 and documentation
1 parent 8c4869a commit f49d0b7

File tree

2 files changed

+59
-2
lines changed

2 files changed

+59
-2
lines changed

README.md

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,25 @@
1-
## action-node-run
2-
GitHub composite action(s) aimed to run node commands
1+
# action-node-run
2+
3+
GitHub Action for installing Node/Yarn packages on development environment and running commands. It caches dependencies for reduced execution times.
4+
5+
## Inputs
6+
7+
| Name | Description | Default | Required |
8+
| -------------- | --------------------------------------------------------- | ------- | -------- |
9+
| `node_version` | The node version to be used. | `18` | `true` |
10+
| `cache_key` | The cache key to be checked. Can be one of `npm`, `yarn`. | `yarn` | `true` |
11+
| `cmd` | The command to be executed. | `nil` | `true` |
12+
13+
## Usage
14+
15+
```yml
16+
jobs:
17+
eslint:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: ePages-de/action-node-run@v1
21+
with:
22+
node_version: 18
23+
cache_key: yarn
24+
cmd: npx eslint
25+
```

action.yml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
name: Run Node/Yarn
2+
description: Install Node/Yarn packages on development environment and run commands.
3+
author: Manel Merino <[email protected]>, Roberto Welzel Filho <[email protected]>, Unai Abrisketa <[email protected]>
4+
5+
inputs:
6+
node_version:
7+
description: The node version to be used. Defaults to `18`.
8+
required: true
9+
default: '18'
10+
cache_key:
11+
description: The cache key to be checked. Can be one of `npm`, `yarn`. Defaults to `yarn`.
12+
required: true
13+
default: yarn
14+
cmd:
15+
description: The command to be executed.
16+
required: true
17+
18+
runs:
19+
using: composite
20+
steps:
21+
- uses: actions/checkout@v2
22+
- uses: actions/setup-node@v3
23+
with:
24+
node-version: ${{ inputs.node_version }}
25+
cache: ${{ inputs.cache_key }}
26+
- shell: bash
27+
run: |
28+
if [ "${{ inputs.cache_key }}" -eq 'npm' ]; then
29+
npm install --production=false
30+
else
31+
yarn install --production=false
32+
fi
33+
- shell: bash
34+
run: ${{ inputs.cmd }}

0 commit comments

Comments
 (0)