Skip to content

Commit d5f719c

Browse files
committed
Validate in CI that the GitHub server versions in package.json and version.ts match
1 parent c5968be commit d5f719c

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

.github/workflows/version-check.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Version Consistency Check
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- "src/github/**"
9+
10+
jobs:
11+
github:
12+
name: Check GitHub server version consistency
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
17+
- name: Check version consistency
18+
run: |
19+
PACKAGE_VERSION=$(node -p "require('./src/github/package.json').version")
20+
TS_VERSION=$(grep -o '".*"' ./src/github/common/version.ts | tr -d '"')
21+
22+
if [ "$PACKAGE_VERSION" != "$TS_VERSION" ]; then
23+
echo "::error::Version mismatch detected!"
24+
echo "::error::package.json version: $PACKAGE_VERSION"
25+
echo "::error::version.ts version: $TS_VERSION"
26+
exit 1
27+
else
28+
echo "✅ Versions match: $PACKAGE_VERSION"
29+
fi

src/github/common/version.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
1+
// If the format of this file changes, so it doesn't simply export a VERSION constant,
2+
// this will break .github/workflows/version-check.yml.
13
export const VERSION = "0.6.2";

0 commit comments

Comments
 (0)