@@ -3,6 +3,7 @@ name: "Check PR Title"
33on :
44 pull_request :
55 types : [opened, edited, reopened, synchronize]
6+ workflow_call :
67
78permissions :
89 contents : read
@@ -11,20 +12,27 @@ jobs:
1112 pr-title :
1213 name : Validate PR title
1314 runs-on : ubuntu-24.04
14- # Run always except: for 'edited' only run when title changed
15- if : >-
16- github.event_name != 'pull_request' ||
17- github.event.action != 'edited' ||
18- contains(toJson(github.event.changes), 'title')
1915 steps :
16+ - name : Skip when PR edited without title change
17+ if : github.event_name == 'pull_request' && github.event.action == 'edited' && !contains(toJson(github.event.changes), 'title')
18+ run : echo "PR edited without title change; skipping title check."
19+
2020 - name : Checkout repository (sparse, PR head)
21+ if : github.event_name == 'pull_request' && (github.event.action != 'edited' || contains(toJson(github.event.changes), 'title'))
2122 uses : actions/checkout@v5
2223 with :
2324 ref : ${{ github.event.pull_request.head.sha }}
2425 fetch-depth : 1
2526 sparse-checkout : |
2627 scripts
2728 sparse-checkout-cone : true
29+
30+ - uses : actions/setup-python@v5
31+ if : github.event_name == 'pull_request' && (github.event.action != 'edited' || contains(toJson(github.event.changes), 'title'))
32+ with :
33+ python-version : ' 3.x'
34+
2835 - name : Run PR title check
36+ if : github.event_name == 'pull_request' && (github.event.action != 'edited' || contains(toJson(github.event.changes), 'title'))
2937 run : |
3038 python3 scripts/check_pr_title.py "${{ github.event.pull_request.title }}"
0 commit comments