Files

60 lines
1.8 KiB
YAML

name: Lint PR Title
# Enforce Conventional Commits on the PR TITLE.
#
# Why the title (not the commits): PRs are squash-merged and the repo's
# `squash_merge_commit_title` is `PR_TITLE`, so the PR title becomes the commit
# subject on master. That subject is what `automated-release.yml`
# (TriPSs/conventional-changelog-action, angular preset) reads to decide the
# version bump, changelog group, and whether a release is cut. A
# non-conventional title => no release / wrong bump.
#
# This is a required status check on master (ruleset). It must run on EVERY PR,
# so there is no `paths:` filter. `pull_request_target` (not `pull_request`) so
# the check also runs - and can post its status - on PRs from forks, the normal
# contributor path. The action only reads the title from the event payload; it
# never checks out PR/fork code, so running in the base-repo context is safe.
on:
pull_request_target:
types:
- opened
- edited
- synchronize
- reopened
permissions:
pull-requests: read
statuses: write
concurrency:
group: pr-title-lint-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
validate-pr-title:
name: Validate PR Title
runs-on: ubuntu-latest
steps:
- name: Lint PR title against Conventional Commits
uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
# Angular preset types - must match the changelog action so a title
# that lints here also produces the intended release behavior.
# Breaking changes (`feat!:`, `fix!:`) are handled natively.
types: |
feat
fix
docs
style
refactor
perf
test
build
ci
chore
revert
requireScope: false