Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/adzz/yarn_command_action
A github action which will run any yarn or npm command in a node alpine container
https://github.com/adzz/yarn_command_action
cd ci deployment docker github-action github-actions javascript js npm npm-script react yarn
Last synced: about 3 hours ago
JSON representation
A github action which will run any yarn or npm command in a node alpine container
- Host: GitHub
- URL: https://github.com/adzz/yarn_command_action
- Owner: Adzz
- License: mit
- Created: 2020-03-05T13:59:35.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2022-01-06T23:33:35.000Z (about 3 years ago)
- Last Synced: 2025-01-20T14:49:49.920Z (14 days ago)
- Topics: cd, ci, deployment, docker, github-action, github-actions, javascript, js, npm, npm-script, react, yarn
- Language: Shell
- Homepage:
- Size: 5.86 KB
- Stars: 4
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Javascript Command Github Action
This is a simple action to allow you to run any command defined in your package.json e.g. `yarn test` or `npm test`. This command will install packages if that has not been done first, then run the supplied command.
Currently uses node:16.13.1-alpine3.15 docker container.
# Examples
## Test - Create React App
If you are using the default create react app, ensure that you pass in the flag `--watchAll=false` so that jest doesn't enter interactive mode, otherwise the action will never finish.
```yaml
on: [pull_request]jobs:
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: test --watchAll=false
```This will default to using `yarn` and the `test` command specified in your `package.json`. Alternatively you can define a specific script there:
```json
"scripts": {
...
"test:ci": "react-scripts test --watchAll=false",
},
```Then do this:
```yaml
on: [pull_request]jobs:
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: test:ci
```### Using NPM instead of yarn
```yaml
on: [pull_request]jobs:
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
package-manager: npm
command: test:ci
```### Lint then test
In the `package.json`
```json
"scripts": {
...
"test:ci": "react-scripts test --watchAll=false",
"eslint": "eslint . --ext .js --ext .jsx --ext .gql --ext .graphql",
},
``````yaml
on: [pull_request]jobs:
eslint:
name: run linter
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: eslint
tests:
name: run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Adzz/[email protected]
with:
command: test:ci
```