Composite GitHub Action to run a command with Yarn. ✨
This action will:
- Use
actions/checkoutandactions/setup-nodeto set up a yarn environment - Use
actions/cacheto restore a cache based on theyarn.lock yarn install --frozen-lockfileif 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: pushAssuming 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: pushSpecifying 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: pushSpecifying 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: pushWe'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.