-
Notifications
You must be signed in to change notification settings - Fork 1
69 lines (58 loc) · 1.98 KB
/
version-reminder.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
name: version-reminder
on:
pull_request:
types:
- opened
permissions:
contents: read
concurrency:
group: ${{ github.repository }}/${{ github.workflow }}/${{ github.ref }}
cancel-in-progress: true
jobs:
version-reminder:
name: version-reminder
runs-on: ubuntu-22.04
timeout-minutes: 1
permissions:
pull-requests: write
steps:
- uses: step-security/harden-runner@8ca2b8b2ece13480cda6dacd3511b49857a23c09 # v2.5.1
with:
egress-policy: audit
- uses: actions/checkout@8ade135a41bc03ea155e62e844d188df1ea18608 # v4.1.0
with:
ref: master
- name: version-check
id: version_check
if: hashFiles('VERSION')
run: |
VERSION_FILE="VERSION"
setOutput() {
echo "${1}=${2}" >> "${GITHUB_OUTPUT}"
}
git fetch origin master
if ! git diff --unified=0 origin/master.. -- $VERSION_FILE | grep '^[+-]' | grep -i "version" >/dev/null
then
echo "remind bumping"
setOutput "remind" 'true'
else
echo "version is being BUMPED $(cat $VERSION_FILE)"
setOutput "remind" 'false'
fi
- name: version-reminder-comment
if: hashFiles('VERSION') && steps.version_check.outputs.remind == 'true'
uses: actions/github-script@d7906e4ad0b1822421a7e6a35d5ca353c962f410 # v6.4.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const backtick = '`';
const body = `
### :bulb: **Don't forget to bump the VERSION file**
By bumping the version in ${backtick}VERSION${backtick} file, we trigger a repo TAG and repo RELEASE, else nothing happens.
`.trim();
github.rest.issues.createComment({
issue_number: context.payload.pull_request.number,
owner: context.repo.owner,
repo: context.repo.repo,
body
});