Allow GitHub workflows to use other Yarn versions #117
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: API Code QA | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- 'api/**.ts' | |
- 'api/package.json' | |
pull_request: | |
branches: | |
- main | |
workflow_dispatch: | |
jobs: | |
lint: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: ${{ github.event.pull_request.head.ref }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 19 | |
- name: Install dependencies | |
run: | | |
cd ./api | |
yarn set version berry | |
yarn cache clean | |
export YARN_ENABLE_IMMUTABLE_INSTALLS=false | |
yarn install | |
- name: Configure Git | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions@github.com | |
git pull | |
- name: Run QA checks | |
continue-on-error: true | |
run: | | |
cd ./api | |
yarn run lint | |
- name: Commit changes | |
continue-on-error: true | |
run: | | |
git add . | |
git reset api/yarn.lock | |
git reset api/.yarnrc.yml | |
git reset api/package.json | |
git commit -m "[auto]: Fix code style" | |
git push | |
- name: Rerun QA checks | |
run: | | |
cd ./api | |
yarn run lint | |
yarn npm audit | |