Skip to content
Latchkey

How to Require Conventional Commit PR Titles

A PR title lint action parses the title against Conventional Commits and fails the status check when it does not match.

Run amannn/action-semantic-pull-request on the pull_request title events. It validates that the title starts with an allowed type (feat, fix, chore, and so on) and reports a failing check otherwise.

Steps

  • Trigger on pull_request with opened, edited, and synchronize.
  • Run amannn/action-semantic-pull-request with GITHUB_TOKEN.
  • List the allowed types in the types input.

Workflow

.github/workflows/ci.yml
on:
  pull_request:
    types: [opened, edited, synchronize]
permissions:
  pull-requests: read
jobs:
  title:
    runs-on: ubuntu-latest
    steps:
      - uses: amannn/action-semantic-pull-request@v5
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        with:
          types: |
            feat
            fix
            chore
            docs
            refactor
          requireScope: false

Gotchas

  • Make the check required in branch protection or a bad title still merges.
  • If you squash-merge, the PR title becomes the commit, so this keeps history clean.

Related guides

Run this faster and cheaper on Latchkey managed runners. Start free →