amannn/action-semantic-pull-request
Validate that PR titles follow the Conventional Commits spec before they can merge.
What it does
amannn/action-semantic-pull-request checks that the PR title parses as a Conventional Commit (type(scope): subject), which matters when you squash-merge and the PR title becomes the commit message.
Types, scopes, and the subject format are all configurable with regex patterns, and validation can be skipped via labels or a [WIP] prefix.
Usage
on:
pull_request:
types: [opened, edited, synchronize]
permissions:
pull-requests: read
jobs:
lint-title:
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v6
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Inputs
| Input | Description | Default | Required |
|---|---|---|---|
types | Custom allowed types (newline delimited) instead of the Conventional Commits defaults. Regex patterns auto-wrapped in ^ $. | - | No |
scopes | Which scopes are allowed (newline delimited). Regex patterns auto-wrapped in ^ $. | - | No |
requireScope | Configure that a scope must always be provided. | - | No |
subjectPattern | Additional regex validation for the subject, e.g. ^(?![A-Z]).+$ to forbid a leading uppercase character. | - | No |
validateSingleCommit | Also validate the commit message on single-commit PRs, since GitHub suggests it as the squash-merge message. | - | No |
ignoreLabels | Skip validation when the PR has one of these labels (newline delimited). | - | No |
Notes
The token is passed as the GITHUB_TOKEN environment variable, not a with: input.
Trigger on opened, edited, and synchronize so the check re-runs when the title is fixed; add labeled/unlabeled if you use ignoreLabels.
Common errors
- A failure listing "No release type found..." or an unknown type means the PR title's type is not in the allowed set; fix the title (e.g.
feat: ...) or extendtypes. - The check not re-running after a title edit means the workflow is missing the
editedactivity type on the pull_request trigger.
Security and pinning
- The action only needs to read the PR; keep permissions at
pull-requests: readand pin to a commit SHA.