Skip to content

Commit f1f5c6c

Browse files
author
Sophia Marie Terry
committed
Draft IPA changelog check
1 parent adcd848 commit f1f5c6c

File tree

1 file changed

+51
-0
lines changed

1 file changed

+51
-0
lines changed
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: IPA Changelog Check
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, edited]
6+
paths:
7+
- 'tools/spectral/ipa/package.json'
8+
9+
jobs:
10+
check-changelog:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout Repository
15+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
16+
17+
- name: Navigate to IPA Directory
18+
working-directory: tools/spectral/ipa
19+
run: |
20+
echo "Navigated to IPA directory."
21+
22+
- name: Check Version Bump
23+
id: version_check
24+
run: |
25+
current_version=$(jq -r '.version' package.json)
26+
echo "Current version: $current_version"
27+
28+
git fetch --tags
29+
previous_version=$(git tag --sort=-v:refname | head -n 1 || echo "none")
30+
echo "Previous version: $previous_version"
31+
32+
version_bump=$([[ "$previous_version" != "v$current_version" ]])
33+
- name: Check Changelog
34+
env:
35+
NEW_VERSION: ${{ steps.version_check.outputs.version_bump }}
36+
run: |
37+
npm run gen-ipa-changelog
38+
39+
# Check for uncommitted changes specific to CHANGELOG.md
40+
uncommitted_changes=$(git status --porcelain | grep "CHANGELOG.md" || echo "")
41+
42+
if [[ "$VERSION_BUMP" == "false" && -n "$uncommitted_changes" ]]; then
43+
echo "Error: Changelog should only be updated alongside a version bump. Please restore the changelog."
44+
exit 1
45+
fi
46+
47+
if [[ "$VERSION_BUMP" == "true" && -z "$uncommitted_changes" ]]; then
48+
echo "Error: Changelog must be updated alongside a version bump. Please run 'npm run gen-ipa-changelog' from the ipa directory and commit the changes."
49+
exit 1
50+
fi
51+
exit 0

0 commit comments

Comments
 (0)