Skip to content

GitHub Action for validation of pull request titles based on the conventional commit specification.

License

Notifications You must be signed in to change notification settings

kontrolplane/pull-request-title-validator

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

pull-request-title-validator

The pull-request-title-validator GitHub Action helps ensuring that contributors provide informative and well-formatted titles - based on the conventional-commits specification. The titles of the pull request could then be used to create automated releases.

Example title

feat(client): add component
│    │        └─────── message
│    └──────────────── scope
└───────────────────── type

Example usage

The action can be used with both the pull_request and pull_request_target trigger.

Default

name: validate-pull-request-title

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize

permissions:
  pull-requests: read

jobs:
  validator:
    name: validate-pull-request-title
    runs-on: ubuntu-latest
    steps:
      - name: validate pull request title
        uses: kontrolplane/[email protected]

Custom types

name: validate-pull-request-title

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize

permissions:
  pull-requests: read

jobs:
  validator:
    name: validate-pull-request-title
    runs-on: ubuntu-latest
    steps:
      - name: validate pull request title
        uses: kontrolplane/[email protected]
        with:
          types: "fix,feat,chore"

Custom scopes

Scopes support regular expression patterns, allowing you to define specific patterns to match the scopes you want to allow. You can also separate multiple scopes using commas.

name: validate-pull-request-title

on:
  pull_request:
    types:
      - opened
      - edited
      - synchronize

permissions:
  pull-requests: read

jobs:
  validator:
    name: validate-pull-request-title
    runs-on: ubuntu-latest
    steps:
      - name: validate pull request title
        uses: kontrolplane/[email protected]
        with:
          scopes: "api,lang,parser,package/.+"

Contributors