Skip to content

Commit

Permalink
Merge branch 'fix/commitlint'
Browse files Browse the repository at this point in the history
  • Loading branch information
GagaMen committed Aug 31, 2023
2 parents cd69cb3 + 4a958a0 commit 49288fd
Showing 1 changed file with 42 additions and 10 deletions.
52 changes: 42 additions & 10 deletions .github/workflows/run-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,25 +61,57 @@ jobs:
working-directory: workspace
run: npm run test:ci

# don't use setup job, because we may need to check out the master branch, which will not work if we only restore the workspace
commitlint:
needs: setup
runs-on: ubuntu-latest
steps:
- name: Cache workspace
uses: actions/cache@v3
- name: Checkout code
uses: actions/checkout@v3
with:
# we need the whole history to run commitlint correctly if multiple commit are pushed at the same time
fetch-depth: 0
path: workspace
key: workspace-${{ github.sha }}

- name: Run commitlint on push
if: github.event_name == 'push'
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18

- name: Setup npm
run: npm install -g npm@9

- name: Cache Node.js modules
uses: actions/cache@v3
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.OS }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.OS }}-node-
- name: Install dependencies
working-directory: workspace
run: npm ci

- name: Checkout master branch
if: github.ref_name != 'master'
working-directory: workspace
run: git fetch origin master && git checkout master && git pull

- name: Change back to triggered branch
if: github.ref_name != 'master'
working-directory: workspace
run: git checkout ${{ github.ref_name }}

- name: Run commitlint on push to master
if: github.ref_name == 'master'
working-directory: workspace
run: npx --no -- commitlint --from ${{ github.event.before }} --to HEAD --verbose
run: npx --no -- commitlint --from ${{ github.event.before }} --verbose

- name: Run commitlint on pull request
if: github.event_name == 'pull_request'
- name: Run commitlint on push to branch
if: github.ref_name != 'master'
working-directory: workspace
run: npx --no -- commitlint --from ${{ github.event.pull_request.base.sha }} --verbose
run: npx --no -- commitlint --from refs/heads/master --verbose

eslint:
needs: setup
Expand Down

0 comments on commit 49288fd

Please sign in to comment.