| 1 | # A squash merge uses the PR title as the commit subject, and the release notes |
| 2 | # (cliff.toml) show it as is. CONTRIBUTING.md has the format. |
| 3 | name: PR title |
| 4 | |
| 5 | on: |
| 6 | pull_request: |
| 7 | types: [opened, edited, reopened, synchronize] |
| 8 | |
| 9 | permissions: {} |
| 10 | |
| 11 | jobs: |
| 12 | title: |
| 13 | name: Conventional title |
| 14 | runs-on: ubuntu-latest |
| 15 | steps: |
| 16 | - name: Check |
| 17 | env: |
| 18 | TITLE: ${{ github.event.pull_request.title }} |
| 19 | run: | |
| 20 | pattern='^(feat|fix|perf|refactor|docs|test|chore|ci|build)(\([a-z0-9-]+\))?!?: [^[:space:]].*$' |
| 21 | if [[ "$TITLE" =~ $pattern ]]; then |
| 22 | echo "ok: $TITLE" |
| 23 | else |
| 24 | echo "::error::PR title must look like 'fix(chat): a sent image no longer blinks' (type(scope): message, no emoji). Got: $TITLE" |
| 25 | exit 1 |
| 26 | fi |