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:
@@ -10,11 +10,28 @@ clone:
|
||||
image: woodpeckerci/plugin-git
|
||||
settings:
|
||||
lfs: false
|
||||
depth: 50
|
||||
|
||||
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
|
||||
image: mcr.microsoft.com/dotnet/sdk:10.0
|
||||
commands:
|
||||
- dotnet restore
|
||||
- dotnet build -c Release
|
||||
- dotnet test -c Release --logger "console;verbosity=detailed"
|
||||
depends_on: [commitlint]
|
||||
|
||||
Reference in New Issue
Block a user