Files
floci/.github/workflows/conventional-commits.yml
T
dependabot[bot] dad7292b94 chore(deps): bump actions/checkout from 4 to 6.0.2 (#1159)
Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 6.0.2.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v4...v6.0.2)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: 6.0.2
  dependency-type: direct:production
  update-type: version-update:semver-major
...
2026-06-04 00:56:55 -05:00

64 lines
2.2 KiB
YAML

name: Conventional Commits
on:
pull_request:
types: [opened, edited, synchronize, reopened]
permissions:
contents: read
jobs:
lint-commits:
name: Commits follow Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6.0.2
with:
fetch-depth: 0
- name: Validate commit messages
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
# Conventional Commits pattern:
# <type>[optional scope]: <description>
#
# Types recognised by semantic-release (commit-analyzer defaults):
# feat, fix, perf, revert, docs, style, chore, refactor, test, build, ci
#
# Breaking changes are signalled by appending ! before the colon:
# feat!: or feat(scope)!:
#
# Merge commits are skipped automatically via --no-merges.
#
# References:
# https://www.conventionalcommits.org/en/v1.0.0/
PATTERN='^(feat|fix|perf|revert|docs|style|chore|refactor|test|build|ci)(\([-a-zA-Z0-9_.,]+\))?!?: .{1,}'
FAILED=0
while IFS= read -r msg; do
if echo "$msg" | grep -qE "$PATTERN"; then
echo "ok: $msg"
else
echo "::error::Commit does not follow Conventional Commits: $msg"
echo ""
echo " Got: $msg"
echo ""
echo " Expected format: <type>[optional scope]: <description>"
echo " Examples:"
echo " feat(dynamodb): add PartiQL ExecuteStatement support"
echo " fix(s3): make us-east-1 bucket creation idempotent"
echo " chore: release 1.5.16"
echo " feat!: remove legacy endpoint"
echo ""
echo " Valid types: feat, fix, perf, revert, docs, style, chore, refactor, test, build, ci"
echo " See: https://www.conventionalcommits.org/en/v1.0.0/"
FAILED=1
fi
done < <(git log --no-merges --format="%s" "$BASE_SHA".."$HEAD_SHA")
exit $FAILED