Skip to content
Latchkey

amannn/action-semantic-pull-request

Validate that PR titles follow the Conventional Commits spec before they can merge.

Community actionCategory: Pull Request AutomationLatest v6View on GitHub

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

workflow (.yml)
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

InputDescriptionDefaultRequired
typesCustom allowed types (newline delimited) instead of the Conventional Commits defaults. Regex patterns auto-wrapped in ^ $.-No
scopesWhich scopes are allowed (newline delimited). Regex patterns auto-wrapped in ^ $.-No
requireScopeConfigure that a scope must always be provided.-No
subjectPatternAdditional regex validation for the subject, e.g. ^(?![A-Z]).+$ to forbid a leading uppercase character.-No
validateSingleCommitAlso validate the commit message on single-commit PRs, since GitHub suggests it as the squash-merge message.-No
ignoreLabelsSkip 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 extend types.
  • The check not re-running after a title edit means the workflow is missing the edited activity type on the pull_request trigger.

Security and pinning

  • The action only needs to read the PR; keep permissions at pull-requests: read and pin to a commit SHA.

Alternatives and related

Frequently asked questions

Why validate the PR title instead of every commit?
With squash merging, the PR title becomes the commit message on the default branch, so linting the title is enough to keep history Conventional-Commits-clean without policing every intermediate commit.
Running amannn/action-semantic-pull-request? Run it on Latchkey managed runners - self-healing and caching included. Start free → 30-day trial · No credit card