-
Notifications
You must be signed in to change notification settings - Fork 0
43 lines (38 loc) · 1.52 KB
/
check_no_SNAPSHOT_master.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
name: No SNAPSHOT version on master branch
on:
pull_request:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.8'
# PRs to the repository master branch are only ok if coming from any patch or release branch
- name: Install cookietemple
run: pip install cookietemple
- name: Check project version
run: |
PROJECTVERSION=$(cookietemple bump-version --project-version . | tail -n1)
echo $PROJECTVERSION;
if [[ $PROJECTVERSION == *"SNAPSHOT"* ]];then
exit -1
else
exit 0
fi
# If the above check failed, post a comment on the PR explaining the failure
# NOTE - this may not work if the PR is coming from a fork, due to limitations in GitHub actions secrets
- name: Post PR comment
if: failure()
uses: mshick/add-pr-comment@v1
with:
message: |
Hi @${{ github.event.pull_request.user.login }},
It looks like this pull-request is has been made against the ${{github.event.pull_request.head.repo.full_name}} `master` branch.
A version check determined that you are using a SNAPSHOT version.
The `master` branch should never have any SNAPSHOT versions, since only fully stable code should be on the `master` branch.
repo-token: ${{ secrets.GITHUB_TOKEN }}
allow-repeats: false