Skip to content

Commit 802d664

Browse files
authored
Merge pull request #1852 from hackmdio/chore/add-release-check-github-workflow
feat: add check-release workflow
2 parents deee9ef + 3a2a80e commit 802d664

File tree

3 files changed

+57
-0
lines changed

3 files changed

+57
-0
lines changed

Diff for: .github/tests/README.md

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Test github actions with act
2+
3+
```bash
4+
act pull_request --container-architecture linux/arm64 -e .github/tests/pull-request.json -j ch
5+
eck-release-pr -P ubuntu-latest=catthehacker/ubuntu:act-latest
6+
```

Diff for: .github/tests/pull-request.json

+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"pull_request": {
3+
"head": {
4+
"ref": "release/1.2.3"
5+
},
6+
"base": {
7+
"ref": "master"
8+
}
9+
}
10+
}

Diff for: .github/workflows/check-release.yml

+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Release PR Checks
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
branches:
7+
- master
8+
9+
jobs:
10+
check-release-pr:
11+
if: startsWith(github.head_ref, 'release/')
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- name: Checkout code
16+
uses: actions/checkout@v3
17+
with:
18+
fetch-depth: 0
19+
20+
- name: Check for release-notes updates
21+
run: |
22+
if ! git diff --exit-code origin/develop -- public/docs/release-notes.md; then
23+
echo "Release notes updated."
24+
else
25+
echo "Error: Release notes not updated in the PR."
26+
exit 1
27+
fi
28+
29+
- name: Compare package.json version with master
30+
run: |
31+
git fetch origin master
32+
MASTER_PACKAGE_VERSION=$(git show origin/master:package.json | jq -r '.version')
33+
BRANCH_PACKAGE_VERSION=$(jq -r '.version' package.json)
34+
35+
if [ "$BRANCH_PACKAGE_VERSION" != "$MASTER_PACKAGE_VERSION" ]; then
36+
echo "Version bumped in package.json."
37+
else
38+
echo "Error: Version in package.json has not been bumped."
39+
exit 1
40+
fi
41+

0 commit comments

Comments
 (0)