Skip to content

Commit 3102f17

Browse files
committed
integrate PR title validation as a required step across workflows
1 parent 0738a9b commit 3102f17

File tree

5 files changed

+31
-5
lines changed

5 files changed

+31
-5
lines changed

.github/workflows/check-pr-title.yml

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: "Check PR Title"
33
on:
44
pull_request:
55
types: [opened, edited, reopened, synchronize]
6+
workflow_call:
67

78
permissions:
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 }}"

.github/workflows/docker.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ permissions:
1616
packages: write
1717

1818
jobs:
19+
pr-title:
20+
uses: ./.github/workflows/check-pr-title.yml
1921
build-and-push:
22+
needs:
23+
- pr-title
2024
name: Build & Push Docker Image
2125
runs-on: ubuntu-latest
2226
if: github.repository == 'learning-process/parallel_programming_course'

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,11 @@ concurrency:
1616
!startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
1717
1818
jobs:
19+
pr-title:
20+
uses: ./.github/workflows/check-pr-title.yml
1921
pre-commit:
22+
needs:
23+
- pr-title
2024
uses: ./.github/workflows/pre-commit.yml
2125
ubuntu:
2226
needs:

.github/workflows/pre-commit.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@ on:
66
workflow_call:
77

88
jobs:
9+
pr-title:
10+
uses: ./.github/workflows/check-pr-title.yml
911
pre-commit:
12+
needs:
13+
- pr-title
1014
runs-on: ubuntu-24.04
1115
container:
1216
image: ghcr.io/learning-process/ppc-ubuntu:1.1

.github/workflows/static-analysis-pr.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,11 @@ concurrency:
2020
!startsWith(github.ref, 'refs/heads/gh-readonly-queue') }}
2121
2222
jobs:
23+
pr-title:
24+
uses: ./.github/workflows/check-pr-title.yml
2325
clang-tidy:
26+
needs:
27+
- pr-title
2428
runs-on: ubuntu-24.04
2529
container:
2630
image: ghcr.io/learning-process/ppc-ubuntu:1.1
@@ -117,6 +121,8 @@ jobs:
117121
echo "clang-tidy run has failed. See previous 'Run clang-tidy' stage logs"
118122
exit 1
119123
nolint-check:
124+
needs:
125+
- pr-title
120126
runs-on: ubuntu-24.04
121127
steps:
122128
- uses: actions/checkout@v5

0 commit comments

Comments
 (0)