Skip to content

Commit f50a2d5

Browse files
fix: Update branch restrictions in PR comments and add version bump check workflow
1 parent 4e292d5 commit f50a2d5

File tree

3 files changed

+62
-5
lines changed

3 files changed

+62
-5
lines changed

.github/workflows/check-branch.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@ jobs:
88
runs-on: ubuntu-latest
99
steps:
1010
- name: Comment PR
11-
if: github.base_ref == 'master' && github.head_ref != 'staging'
11+
if: github.base_ref == 'master' && github.head_ref != 'developement'
1212
uses: thollander/actions-comment-pull-request@v2
1313
with:
1414
message: |
15-
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
15+
We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the development branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch.
1616
- name: Check branch
17-
if: github.base_ref == 'master' && github.head_ref != 'staging'
17+
if: github.base_ref == 'master' && github.head_ref != 'development'
1818
run: |
19-
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the next branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
19+
echo "ERROR: We regret to inform you that you are currently not able to merge your changes into the master branch due to restrictions applied by our SRE team. To proceed with merging your changes, we kindly request that you create a pull request from the development branch. Our team will then review the changes and work with you to ensure a successful merge into the master branch."
2020
exit 1
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# Ensures package.json and CHANGELOG.md are bumped compared to the latest tag when relevant files change.
2+
name: Check Version Bump
3+
4+
on:
5+
pull_request:
6+
paths:
7+
- 'package.json'
8+
- 'CHANGELOG.md'
9+
10+
jobs:
11+
version-bump:
12+
name: Version & Changelog bump
13+
runs-on: ubuntu-latest
14+
steps:
15+
- name: Checkout
16+
uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Setup Node
21+
uses: actions/setup-node@v4
22+
with:
23+
node-version: '22.x'
24+
25+
- name: Check version bump
26+
run: |
27+
set -e
28+
PKG_VERSION=$(node -p "require('./package.json').version.replace(/^v/, '')")
29+
if [ -z "$PKG_VERSION" ]; then
30+
echo "::error::Could not read version from package.json"
31+
exit 1
32+
fi
33+
git fetch --tags --force 2>/dev/null || true
34+
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || true)
35+
if [ -z "$LATEST_TAG" ]; then
36+
echo "No existing tags found. Skipping version-bump check (first release)."
37+
exit 0
38+
fi
39+
LATEST_VERSION="${LATEST_TAG#v}"
40+
LATEST_VERSION="${LATEST_VERSION%%-*}"
41+
if [ "$(printf '%s\n' "$LATEST_VERSION" "$PKG_VERSION" | sort -V | tail -1)" != "$PKG_VERSION" ]; then
42+
echo "::error::Version bump required: package.json version ($PKG_VERSION) is not greater than latest tag ($LATEST_TAG). Please bump the version in package.json."
43+
exit 1
44+
fi
45+
if [ "$PKG_VERSION" = "$LATEST_VERSION" ]; then
46+
echo "::error::Version bump required: package.json version ($PKG_VERSION) equals latest tag ($LATEST_TAG). Please bump the version in package.json."
47+
exit 1
48+
fi
49+
CHANGELOG_VERSION=$(sed -nE 's/^## \[v?([0-9]+\.[0-9]+\.[0-9]+).*/\1/p' CHANGELOG.md | head -1)
50+
if [ -z "$CHANGELOG_VERSION" ]; then
51+
echo "::error::Could not find a version entry in CHANGELOG.md (expected line like '## [v1.0.0](...)')."
52+
exit 1
53+
fi
54+
if [ "$CHANGELOG_VERSION" != "$PKG_VERSION" ]; then
55+
echo "::error::CHANGELOG version mismatch: CHANGELOG.md top version ($CHANGELOG_VERSION) does not match package.json version ($PKG_VERSION). Please add or update the CHANGELOG entry for $PKG_VERSION."
56+
exit 1
57+
fi
58+
echo "Version bump check passed: package.json and CHANGELOG.md are at $PKG_VERSION (latest tag: $LATEST_TAG)."

.github/workflows/unit-test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
branches:
55
- master
66
- main
7-
- staging
87
- development
98
jobs:
109
build-test:

0 commit comments

Comments
 (0)