A reusable GitHub Action workflow to enforce commit message best practices using Conform.
name: Commit Message Conformance
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
commitmsg-conform:
uses: cloudbuildlab/actions-commitmsg-conform/.github/workflows/commitmsg-conform.yml@v1name: Commit Message Conformance
on:
pull_request: {}
permissions:
statuses: write
checks: write
contents: read
pull-requests: read
jobs:
validate-commit:
uses: cloudbuildlab/actions-commitmsg-conform/.github/workflows/commitmsg-conform.yml@v1
with:
config: |
policies:
- type: commit
spec:
dco: false
gpg:
required: false
gitHubOrganization: cloudbuildlab
spellcheck:
locale: US
maximumOfOneCommit: false
header:
length: 89
imperative: true
case: lower
invalidLastCharacters: .
body:
required: true
conventional:
types:
- chore
- ci
- docs
- feat
- fix
- refactor
- release
- revert
- style
- test
scopes: [".*"]This workflow follows semantic versioning. You can use it in two ways:
-
Major Version Tag (Recommended):
uses: cloudbuildlab/actions-commitmsg-conform/.github/workflows/commitmsg-conform.yml@v1
This will automatically use the latest release within the v1.x.x series.
-
Specific Version:
uses: cloudbuildlab/actions-commitmsg-conform/.github/workflows/commitmsg-conform.yml@v1.0.1
This pins to a specific version for maximum stability.
See the Releases page for a full list of versions and changes.
The workflow accepts a config input that allows you to provide a custom Conform configuration. If no configuration is provided, it will use the default configuration which enforces:
- Conventional commit types (chore, ci, docs, feat, fix, refactor, release, revert, style, test)
- Commit message length limits (89 characters)
- Imperative mood
- Lower case
- No trailing periods
- Required commit body
- Spell checking (US locale)
- Optional DCO and GPG signing
The configuration supports the following policies:
dco: Enable/disable Developer Certificate of Origingpg: GPG signing requirementsspellcheck: Spell checking configurationmaximumOfOneCommit: Limit to one commitheader: Commit message header formattingbody: Commit message body requirementsconventional: Conventional commit type and scope rules
- Validates commit messages against configurable patterns
- Supports custom Conform configurations
- Easy to integrate into existing workflows
- Runs on pull request events by default
- Uses Docker for consistent execution
- GitHub reporter for detailed feedback
This project is licensed under the MIT License - see the LICENSE file for details.