-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (35 loc) · 1.27 KB
/
changeset.yml
File metadata and controls
41 lines (35 loc) · 1.27 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: Changeset Check
on:
pull_request:
branches:
- main
jobs:
changeset-check:
name: Check for Changeset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Check for changeset
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_REF: ${{ github.head_ref }}
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
if [[ "$HEAD_REF" == changeset-release/* ]] || [[ "$PR_TITLE" == "chore: version packages" ]]; then
echo "Skipping changeset check for release PR"
exit 0
fi
NEW_CHANGESETS=$(git diff --name-only --diff-filter=A "$BASE_SHA...HEAD" -- '.changeset/*.md' | grep -v 'README\.md' || true)
if [ -z "$NEW_CHANGESETS" ]; then
echo "No new changeset found in this PR."
echo ""
echo "Every PR must add a changeset file to .changeset/."
echo "Run 'npm run changeset' to create one describing your change."
echo "If no version bump is needed, run 'npx changeset --empty'."
exit 1
fi
echo "New changeset(s) added in this PR:"
echo "$NEW_CHANGESETS"