Skip to content

Commit e087de7

Browse files
author
Sophia Marie Terry
committed
Refined ipa commit check
1 parent 99675b3 commit e087de7

File tree

1 file changed

+8
-30
lines changed

1 file changed

+8
-30
lines changed

.github/workflows/ipa-commit.yml

Lines changed: 8 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -3,43 +3,21 @@ name: IPA Commit Check
33
on:
44
pull_request:
55
types: [opened, synchronize, reopened, edited]
6+
paths:
7+
- 'tools/spectral/ipa/**'
68

79
jobs:
810
check-pr-title:
911
runs-on: ubuntu-latest
1012

1113
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'
14+
- name: Validate PR Title with IPA scope
15+
env:
16+
PR_TITLE: ${{ github.event.pull_request.title }}
3317
run: |
34-
TITLE="${{ github.event.pull_request.title }}"
3518
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."
19+
if [[ ! "$PR_TITLE" =~ $PATTERN ]]; then
20+
echo "PR title must follow the conventional commit format with (ipa) as the scope."
3821
echo "Example: feat(ipa): My New Rule"
3922
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."
23+
fi

0 commit comments

Comments
 (0)