-
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 1.71 KB
/
pr-checks.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
70
71
72
73
74
75
76
77
name: Check Pull Request
run-name: CheckPullRequest
on:
pull_request:
types: [opened, synchronize]
branches: main
concurrency:
group: 'pull_request'
cancel-in-progress: true
permissions:
pull-requests: write
contents: write
pages: write
jobs:
paths-filter:
name: Filter out non code changes
runs-on: ubuntu-latest
timeout-minutes: 5
outputs:
code-changed: ${{ steps.filter.outputs.src }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Filter Changed Files
uses: AurorNZ/paths-filter@v4
id: filter
with:
filters: |
src:
- 'src/**/*'
- '!src/**/*.test.*'
check-version:
needs: paths-filter
if: needs.paths-filter.outputs.code-changed == 'true'
name: Version number was bumped
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Get New Version
run: |
new_version=$(npm pkg get version | xargs)
echo "NEW=${new_version}" >> $GITHUB_ENV
- name: Checkout Repo
uses: actions/checkout@v4
with:
ref: main
- name: Get Main Version
run: |
main_version=$(npm pkg get version | xargs)
echo "MAIN=${main_version}" >> $GITHUB_ENV
- name: Compare Versions
run: |
if [[ ${{ env.NEW }} == ${{ env.MAIN }} ]]; then
exit 1
fi
- name: Post PR Comment
if: failure()
uses: mshick/add-pr-comment@v2
with:
message: Please bump the version in package.json!
refresh-message-position: true
allow-repeats: true