From ee976440178eb8f1d4eb9458e1320f52f058c0da Mon Sep 17 00:00:00 2001 From: David Yonge-Mallo Date: Sun, 14 Jun 2026 07:03:07 +0200 Subject: [PATCH] ci: enforce Conventional Commits on PRs --- .github/workflows/ci.yml | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4c52bcfa..9e3e3e42 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,34 @@ env: NVIM_TYPECHECK_VERSION: v0.12.2 jobs: + commit-style: + runs-on: ubuntu-latest + name: Conventional commits + if: github.event_name == 'pull_request' + steps: + - uses: actions/checkout@v4 + with: + # Skip GitHub's synthetic merge commit (would fail `cz check`). + ref: ${{ github.event.pull_request.head.sha }} + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.12" + + - name: Install commitizen + run: pip install commitizen + + - name: Lint commits + run: | + range="origin/${{ github.base_ref }}..HEAD" + if [ -z "$(git rev-list "$range")" ]; then + echo "No new commits vs base; skipping cz check." + exit 0 + fi + cz check --rev-range "$range" + lint: runs-on: ubuntu-latest name: Lint (stylua)