Skip to content

Commit 99675b3

Browse files
author
Sophia Marie Terry
committed
Draft ipa commit check
1 parent 7617cb8 commit 99675b3

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed

.github/workflows/ipa-commit.yml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: IPA Commit Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
7+
jobs:
8+
check-pr-title:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
# Check out the repository
13+
- name: Checkout repository
14+
uses: actions/checkout@v692973e3d937129bcbf40652eb9f2f61becf3332
15+
16+
# Fetch PR changes
17+
- name: Get List of Changed Files
18+
id: changes
19+
run: |
20+
git fetch origin "${{ github.event.pull_request.base.ref }}" --depth=1
21+
git diff --name-only "origin/${{ github.event.pull_request.base.ref }}" > changed_files.txt
22+
if grep -qE "^tools/spectral/ipa/" changed_files.txt; then
23+
echo "ipa_changes=true" >> $GITHUB_ENV
24+
else
25+
echo "ipa_changes=false" >> $GITHUB_ENV
26+
fi
27+
shell: bash
28+
continue-on-error: false
29+
30+
# Validate PR title using a conventional commit format with (ipa) scope
31+
- name: Validate PR Title
32+
if: env.ipa_changes == 'true'
33+
run: |
34+
TITLE="${{ github.event.pull_request.title }}"
35+
PATTERN="^[a-z]+\(ipa\): .+$"
36+
if [[ ! "$TITLE" =~ $PATTERN ]]; then
37+
echo "Error: PR title must follow the conventional commit format with (ipa) as the scope."
38+
echo "Example: feat(ipa): My New Rule"
39+
exit 1
40+
fi
41+
42+
- name: Skip validation when IPA directory untouched
43+
if: env.ipa_changes == 'false'
44+
run: |
45+
echo "No files were modified in tools/spectral/ipa. Skipping IPA-specific commit validation."

0 commit comments

Comments
 (0)