Skip to content

Commit 1e3cc7f

Browse files
committed
Add more checks for the release commit
Check that it's on the corresponding release branch in case of tag, or is targeted there in case of PR.
1 parent ad32d78 commit 1e3cc7f

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

.github/workflows/prerelease-sanity.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,3 +56,25 @@ jobs:
5656
git log --oneline -1 @^0
5757
git log --oneline -1 @^0~
5858
! git diff --exit-code @^0~ @^0 -- version.config
59+
60+
- name: The tagged release commit must belong to the corresponding release branch
61+
if: github.event.name == 'push'
62+
run: |
63+
version=$(sed -n "s/^version = //p" version.config)
64+
echo $version
65+
66+
branch=$(echo ${version} | sed 's/\([0-9]\+\.[0-9]\+\.\).*/\1x/')
67+
echo $branch
68+
69+
echo ${{ github.event.pull_request.base.ref }} | grep $branch
70+
71+
- name: The release PR must target the corresponding release branch
72+
if: github.event.name == 'pull_request'
73+
run: |
74+
version=$(sed -n "s/^version = //p" version.config)
75+
echo Version '$version'
76+
77+
branch=$(echo ${version} | sed 's/\([0-9]\+\.[0-9]\+\.\).*/\1x/')
78+
echo Expected branch '$branch'
79+
80+
git branch --contains @ | grep $branch

0 commit comments

Comments
 (0)