-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (37 loc) · 1.1 KB
/
check-version-pr.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
name: Check version
on:
pull_request:
branches:
- master
- main
jobs:
check-version:
name: Check Version
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- name: Get PR version
id: pr_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Checkout main branch
uses: actions/checkout@v3
with:
ref: master
- name: Get main version
id: main_version
run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT
- name: Compare versions
run: |
if [ "${{ steps.pr_version.outputs.VERSION }}" != "${{ steps.main_version.outputs.VERSION }}" ]; then
echo "Version changed: ${{ steps.pr_version.outputs.VERSION }}"
else
echo "Version did not change"
exit 1
fi