Files
codex-security/.github/workflows/validate-pr-title.yml
2026-10-22 13:49:22 +08:00

24 lines
724 B
YAML

name: Validate PR Title
on:
pull_request:
types: [opened, edited, reopened, synchronize]
permissions: {}
jobs:
validate-pr-title:
name: Validate PR Title
runs-on: ubuntu-latest
steps:
- name: Check conventional title
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
conventional_title='^([a-z][a-z0-9-]*)(\([a-z0-9][a-z0-9._/-]*\))?(!)?:[ ]([^[:space:]].*[^[:space:]]|[^[:space:]])$'
if [[ "$PR_TITLE" == *$'\n'* || "$PR_TITLE" == *$'\r'* ||
! "$PR_TITLE" =~ $conventional_title ]]; then
echo '::error::Pull request title must follow <type>[optional scope][!]: <description>.'
exit 1
fi