-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 1.29 KB
/
Copy pathsemver.yaml
File metadata and controls
41 lines (35 loc) · 1.29 KB
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
name: Check version bump
on:
pull_request:
branches: [main]
types: [opened, reopened, synchronize, ready_for_review]
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/ISSUE_TEMPLATE/**'
- '.github/pull_request_template.md'
- '.github/workflows/**'
- '.gitignore'
- '.editorconfig'
- '.prettierrc'
jobs:
semver-check:
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.draft == false }}
runs-on: ubuntu-latest
steps:
- name: Checkout PR branch
uses: actions/checkout@v7
- name: Fetch main branch
run: git fetch origin main
- name: Compare package.json versions
run: |
PR_VERSION=$(jq -r '.version' package.json)
MAIN_VERSION=$(git show origin/main:package.json | jq -r '.version')
echo "Main branch version: $MAIN_VERSION"
echo "PR branch version: $PR_VERSION"
if [ "$PR_VERSION" = "$MAIN_VERSION" ]; then
echo "❌ Version not updated!"
exit 1
else
echo "✅ Version updated."
fi