File tree Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Expand file tree Collapse file tree 1 file changed +45
-0
lines changed Original file line number Diff line number Diff line change 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."
You can’t perform that action at this time.
0 commit comments