| 1 | name: PR title |
| 2 | |
| 3 | on: |
| 4 | pull_request: |
| 5 | types: [labeled, edited, reopened, ready_for_review, synchronize] |
| 6 | |
| 7 | concurrency: |
| 8 | group: pr-title-${{ github.event.pull_request.number }} |
| 9 | cancel-in-progress: true |
| 10 | |
| 11 | permissions: {} |
| 12 | |
| 13 | jobs: |
| 14 | check-format: |
| 15 | name: Check format |
| 16 | # Triggered when: |
| 17 | # - The `ready` label is added. |
| 18 | # - A ready PR's title is edited. |
| 19 | # - A ready PR is reopened. |
| 20 | # - A draft PR with the `ready` label is marked ready for review. |
| 21 | # - New commits are pushed to a ready PR (so its latest commit has a title check status). |
| 22 | if: >- |
| 23 | github.repository_owner == 'vllm-project' && |
| 24 | github.event.pull_request.draft == false && |
| 25 | contains(github.event.pull_request.labels.*.name, 'ready') && |
| 26 | (github.event.action != 'labeled' || github.event.label.name == 'ready') && |
| 27 | (github.event.action != 'edited' || github.event.changes.title != null) |
| 28 | runs-on: ubuntu-slim |
| 29 | steps: |
| 30 | - name: Validate title |
| 31 | env: |
| 32 | PR_TITLE: ${{ github.event.pull_request.title }} |
| 33 | run: | |
| 34 | pattern='^(\[[^][]+\])+ +[^[:space:]].*$' |
| 35 | if [[ "$PR_TITLE" =~ $pattern ]]; then |
| 36 | exit 0 |
| 37 | fi |
| 38 | |
| 39 | echo "::error::PR title must start with one or more [Tag] prefixes, followed by a space and a description." |
| 40 | exit 1 |