Skip to content

Commit 112ae04

Browse files
committed
Add version-check.yml workflow
1 parent e8ea64d commit 112ae04

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Version Check
2+
3+
on:
4+
pull_request:
5+
branches: [main]
6+
7+
jobs:
8+
check-version:
9+
name: version-check
10+
runs-on: ubuntu-latest
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Check version bump
17+
run: |
18+
# Get version from PR branch
19+
PR_VERSION=$(jq -r '.Version // "0.0.0"' dataset_description.json)
20+
21+
# Get version from main branch
22+
git fetch origin main
23+
git checkout origin/main -- dataset_description.json 2>/dev/null || echo '{}' > dataset_description.json
24+
MAIN_VERSION=$(jq -r '.Version // "0.0.0"' dataset_description.json)
25+
26+
# Restore PR version
27+
git checkout HEAD -- dataset_description.json
28+
29+
echo "Main version: $MAIN_VERSION"
30+
echo "PR version: $PR_VERSION"
31+
32+
if [ "$PR_VERSION" == "$MAIN_VERSION" ]; then
33+
echo "::error::Version not bumped. Update 'Version' field in dataset_description.json"
34+
exit 1
35+
fi
36+
37+
echo "Version check passed: $MAIN_VERSION -> $PR_VERSION"

0 commit comments

Comments
 (0)