Skip to content

Commit

Permalink
Add changes for v1 and documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
Unai Abrisketa committed May 9, 2022
1 parent 8c4869a commit f49d0b7
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 2 deletions.
27 changes: 25 additions & 2 deletions README.md
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
```
34 changes: 34 additions & 0 deletions action.yml
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 }}

0 comments on commit f49d0b7

Please sign in to comment.