Skip to content

Commit

Permalink
configure commitlint on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
michelegera committed Nov 30, 2023
1 parent 969a9c8 commit a68e838
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/commitlint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: commitlint

on:
push:
branches:
- main
pull_request: {}

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

jobs:
commitlint:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: wyvox/action-setup-pnpm@v3
name: Install pnpm and node
with:
pnpm-version: 8.5.1
node-version: 18.x

- name: Print versions
run: |
git --version
node --version
pnpm --version
- name: Install commitlint
run: |
pnpm install @commitlint/cli@"$(pnpm show @commitlint/cli version)"
pnpm install @commitlint/config-conventional@"$(pnpm show @commitlint/config-conventional version)"
- name: Validate current commit (last commit) with commitlint
if: github.event_name == 'push'
run: pnpm commitlint --from HEAD~1 --to HEAD --verbose

- name: Validate PR commits with commitlint
if: github.event_name == 'pull_request'
run: pnpm commitlint --from ${{ github.event.pull_request.head.sha }}~${{ github.event.pull_request.commits }} --to ${{ github.event.pull_request.head.sha }} --verbose

0 comments on commit a68e838

Please sign in to comment.