From 778eba5dec883ca9eef45771939128d7b2471866 Mon Sep 17 00:00:00 2001 From: Kristoffer Dalby Date: Wed, 29 Apr 2026 13:49:56 +0000 Subject: [PATCH] .github/workflows: enforce commit-lint on pull requests Two jobs: test runs the rule's fixture suite; check runs lint-range over the PR commit range. test gates check so a broken rule never silently lands. skip-issuebot --- .github/workflows/commit-lint.yml | 39 +++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/commit-lint.yml diff --git a/.github/workflows/commit-lint.yml b/.github/workflows/commit-lint.yml new file mode 100644 index 000000000..223cc6269 --- /dev/null +++ b/.github/workflows/commit-lint.yml @@ -0,0 +1,39 @@ +name: Commit Lint + +on: + pull_request: + types: [opened, synchronize, reopened, edited] + +permissions: + contents: read + +jobs: + test: + name: Rule unit tests + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + - uses: hustcer/setup-nu@920172d92eb04671776f3ba69d605d3b09351c30 # v3.22 + with: + version: "*" + - name: Run rule unit tests + run: nu commit-lint.test.nu + working-directory: .github/scripts + + check: + name: Issue references in commits + needs: test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1 + with: + fetch-depth: 0 + - uses: hustcer/setup-nu@920172d92eb04671776f3ba69d605d3b09351c30 # v3.22 + with: + version: "*" + - name: Check that PR commits reference an issue + env: + BASE_SHA: ${{ github.event.pull_request.base.sha }} + HEAD_SHA: ${{ github.event.pull_request.head.sha }} + run: | + nu -c 'use .github/scripts/commit-lint.nu *; lint-range $env.BASE_SHA $env.HEAD_SHA'