Update workflow to run cypress only on PRs to Main #54
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Lint & Test Workflow | |
on: | |
pull_request: | |
branches: [main, dev] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: "18" | |
- name: Install dependencies | |
run: yarn install | |
- name: Run Eslint | |
run: yarn lint --strict | |
- name: Run Jest tests | |
run: yarn test | |
- name: Run Cypress tests | |
run: | | |
if [[ ${{ github.event.pull_request.base.ref }} == 'main' ]]; then | |
yarn cypress | |
else | |
echo "Skipping Cypress tests for non-main branch." | |
fi |