Composite GitHub Action to run a command with Yarn. ✨
This action will:
- Use
actions/checkout
andactions/setup-node
to set up a yarn environment - Use
actions/cache
to restore a cache based on theyarn.lock
yarn install --frozen-lockfile
if the folder didn't exist in the cache- Run
yarn ${{ inputs.command }}
command
: Command to run. Required.
Running a single yarn test
command on all commit pushes:
# .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
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:
# .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
Specifying a Node.js version
# .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
# .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
We'd love to have you contribute! Check the issue tracker for issues labeled Accepting PRs 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 label indicates good introductory issues.
Please note that this project is released with a Contributor Covenant. By participating in this project you agree to abide by its terms. See CODE_OF_CONDUCT.md.