https://github.com/codecademy/run-on-yarn
Composite GitHub Action to run a command with Yarn. ✨
https://github.com/codecademy/run-on-yarn
Last synced: 24 days ago
JSON representation
Composite GitHub Action to run a command with Yarn. ✨
- Host: GitHub
- URL: https://github.com/codecademy/run-on-yarn
- Owner: Codecademy
- License: mit
- Created: 2021-10-20T16:08:24.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2024-10-17T15:05:34.000Z (over 1 year ago)
- Last Synced: 2025-04-09T18:13:32.978Z (11 months ago)
- Size: 20.5 KB
- Stars: 2
- Watchers: 7
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# run-on-yarn
Composite GitHub Action to run a command with Yarn. ✨
## Usage
This action will:
1. Use `actions/checkout` and `actions/setup-node` to set up a yarn environment
2. Use `actions/cache` to restore a cache based on the `yarn.lock`
3. `yarn install --frozen-lockfile` if the folder didn't exist in the cache
4. Run `yarn ${{ inputs.command }}`
### Inputs
* `command`: Command to run. Required.
## Example
### Simplest Usage
Running a single `yarn test` command on all commit pushes:
```yml
# .github/workflows/push.yml
name: Push CI
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: Codecademy/run-on-yarn@v1
with:
command: test
on: push
```
### Matrix of Commands
Assuming the `compile`, `format:verify`, and `test` scripts exist in your `package.json`, this setup will run those commands in parallel as your Push CI job:
```yml
# .github/workflows/push.yml
name: Push CI
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: Codecademy/run-on-yarn@v1
with:
command: ${{ matrix.command }}
strategy:
fail-fast: false
matrix:
command: ['compile', 'format:verify', 'test']
on: push
```
### Optional Inputs
Specifying a Node.js version
```yml
# .github/workflows/push.yml
name: Push CI
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: Codecademy/run-on-yarn@v1
with:
command: test
node-version: 16
on: push
```
Specifying a different Github token to be used during checkout
**Note:** this is only necessary to override in certain extreme edge cases
```yml
# .github/workflows/push.yml
name: Push CI
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: Codecademy/run-on-yarn@v1
with:
command: test
github-token: ${{ secrets.PERSONAL_TOKEN }}
on: push
```
### Contribution Guidelines
We'd love to have you contribute!
Check the [issue tracker](https://github.com/Codecademy/run-on-yarn/issues) for issues labeled [Accepting PRs](https://github.com/Codecademy/run-on-yarn/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22Accepting+PRs%22) to find bug fixes and feature requests the community can work on.
If this is your first time working with this code, the [Good First issue](https://github.com/Codecademy/guidelines/issues?utf8=%E2%9C%93&q=is%3Aissue+is%3Aopen+label%3A%22Good+First+Issue%22+) label indicates good introductory issues.
Please note that this project is released with a [Contributor Covenant](https://www.contributor-covenant.org).
By participating in this project you agree to abide by its terms.
See [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).