Conventional Commits Check
Validate commit messages against the Conventional Commits specification.
Requirements
Section titled “Requirements”- By default, this action runs actions/checkout with fetch-depth: 0 so the commit history is available.
- Set checkout: false if you already checked out the repository with the correct history depth.
Inputs
Section titled “Inputs”Basic Configuration
Section titled “Basic Configuration”- checkout: Whether to run actions/checkout before validation (default:
true). - base-sha: Base commit SHA to compare against (optional; defaults to merge-base with origin/$GITHUB_BASE_REF, origin/main, or origin/master).
- head-sha: Head commit SHA to validate (optional; defaults to HEAD).
- pr-comment: Comment on PR with validation results -
none,error,success, orboth(default:error).
Advanced Configuration
Section titled “Advanced Configuration”-
types: Allowed types (pipe-separated, default:
feat|fix|docs|style|refactor|perf|test|build|ci|chore|revert).- Example:
feat|fix|hotfixto only allow these types - Supports regex patterns:
feat|fix|JIRA-\d+
- Example:
-
scopes: Allowed scopes (regex patterns, pipe-separated, default: empty = all allowed).
- Example:
api|ui|coreto restrict to these scopes - Example:
[a-z]+to only allow lowercase scopes - Example:
JIRA-\d+|PROJ-\d+to require ticket numbers
- Example:
-
require-scope: Require a scope in each commit message (default:
false). -
ignore-commits: Patterns to ignore (regex, newline-separated).
- Example:
^Merge branch|^Revertto skip merge commits - Useful for automated commits
- Example:
-
validate-pr-title: Also validate the PR title against conventional commits format (default:
false).
Outputs
Section titled “Outputs”- status: Validation status -
successorfailure - invalid-count: Number of invalid commits
- valid-count: Number of valid commits
- error-message: Detailed error message if validation failed
Examples
Section titled “Examples”Basic Usage (pull_request)
Section titled “Basic Usage (pull_request)”With Custom Types
Section titled “With Custom Types”With Scope Validation
Section titled “With Scope Validation”With Ticket Numbers in Scopes
Section titled “With Ticket Numbers in Scopes”Ignore Automated Commits
Section titled “Ignore Automated Commits”Validate PR Title + Commits
Section titled “Validate PR Title + Commits”Using Outputs
Section titled “Using Outputs”Advanced Example with All Options
Section titled “Advanced Example with All Options”Configuration Details
Section titled “Configuration Details”The default types follow the Conventional Commits specification:
feat: A new featurefix: A bug fixdocs: Documentation only changesstyle: Changes that don’t affect code meaning (formatting, etc.)refactor: Code change that neither fixes a bug nor adds a featureperf: Code change that improves performancetest: Adding or correcting testsbuild: Changes to build system or dependenciesci: Changes to CI configurationchore: Other changes that don’t modify src or test filesrevert: Reverts a previous commit
You can customize this list to match your workflow.
Scopes
Section titled “Scopes”Scopes are optional identifiers that provide additional context. Common patterns:
- Component names:
(api),(ui),(auth) - Ticket numbers:
(JIRA-123),(GH-456) - Feature areas:
(dashboard),(settings)
Use the scopes input to restrict which scopes are allowed (regex patterns).
Use require-scope: true to make scopes mandatory.
PR Comments
Section titled “PR Comments”The action can automatically comment on PRs with validation results:
noneorfalse: No commentserror: Comment only on failures (default)success: Comment only on successbothortrue: Always comment