Skip to content

Commit

Permalink
ci(github): compliance test for conventional commits
Browse files Browse the repository at this point in the history
This adds a GitHub action workflow that runs commitizen's `cz check`
on the revision range of a PR. The workflow errors when any commit
message is not compliant with the chosen convention, which is the
`cz_customize` configuration in `pyproject.toml` at this point.

Refs: #10
  • Loading branch information
mih committed Jun 6, 2024
1 parent 00a4992 commit be975ec
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/conventional-commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Conventional commits

on: pull_request

jobs:
check-messages:
runs-on: ubuntu-latest
steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: 3.11
architecture: x64
- name: Checkout
uses: actions/checkout@v4
with:
# we need all the history to be able to resolve revision ranges properly
fetch-depth: 0
- name: Install commitizen
run: python -m pip install commitizen
- name: Run commit message checks
run: |
echo cz check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}
cz check --rev-range ${{ github.event.pull_request.base.sha }}..${{ github.event.pull_request.head.sha }}

0 comments on commit be975ec

Please sign in to comment.