ci: add commitlint to enforce conventional commits on PRs

Validates all commit messages in a PR follow the conventional commits
format before allowing build/test to proceed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Barry Walker
2026-01-13 18:22:44 -05:00
parent 6cac693e9c
commit de0a3c5d84
+17
View File
@@ -10,11 +10,28 @@ clone:
image: woodpeckerci/plugin-git image: woodpeckerci/plugin-git
settings: settings:
lfs: false lfs: false
depth: 50
steps: steps:
# Validate commit messages follow conventional commits
- name: commitlint
image: node:22-alpine
commands:
- npm install -g @commitlint/cli @commitlint/config-conventional
- |
echo "module.exports = { extends: ['@commitlint/config-conventional'] };" > commitlint.config.js
- |
# Check all commits in the PR
git log --format=%s origin/main..HEAD | while read -r msg; do
echo "Checking: $msg"
echo "$msg" | commitlint || exit 1
done
- echo "All commits follow conventional commit format"
- name: build-and-test - name: build-and-test
image: mcr.microsoft.com/dotnet/sdk:10.0 image: mcr.microsoft.com/dotnet/sdk:10.0
commands: commands:
- dotnet restore - dotnet restore
- dotnet build -c Release - dotnet build -c Release
- dotnet test -c Release --logger "console;verbosity=detailed" - dotnet test -c Release --logger "console;verbosity=detailed"
depends_on: [commitlint]