-
Notifications
You must be signed in to change notification settings - Fork 76
38 lines (32 loc) · 1.35 KB
/
check-pr-title.yml
File metadata and controls
38 lines (32 loc) · 1.35 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
name: "Check PR Title"
on:
pull_request:
types: [opened, edited, reopened, synchronize]
workflow_call:
permissions:
contents: read
jobs:
pr-title:
name: Validate PR title
runs-on: ubuntu-24.04
steps:
- name: Skip when PR edited without title change
if: github.event_name == 'pull_request' && github.event.action == 'edited' && !contains(toJson(github.event.changes), 'title')
run: echo "PR edited without title change; skipping title check."
- name: Checkout repository (sparse, PR head)
if: github.event_name == 'pull_request' && (github.event.action != 'edited' || contains(toJson(github.event.changes), 'title'))
uses: actions/checkout@v5
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 1
sparse-checkout: |
scripts
sparse-checkout-cone: true
- uses: actions/setup-python@v5
if: github.event_name == 'pull_request' && (github.event.action != 'edited' || contains(toJson(github.event.changes), 'title'))
with:
python-version: '3.x'
- name: Run PR title check
if: github.event_name == 'pull_request' && (github.event.action != 'edited' || contains(toJson(github.event.changes), 'title'))
run: |
python3 scripts/check_pr_title.py "${{ github.event.pull_request.title }}"