-
Notifications
You must be signed in to change notification settings - Fork 0
38 lines (35 loc) · 1.2 KB
/
changeset.yml
File metadata and controls
38 lines (35 loc) · 1.2 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
name: Changeset Required
on:
pull_request:
branches: [main, dev, staging]
permissions:
contents: read
pull-requests: read
jobs:
changeset:
name: Changeset Required
runs-on: ubuntu-latest
timeout-minutes: 2
# Skip changeset check on promotion PRs (dev→staging, staging→main)
if: |
github.event.pull_request.base.ref != 'staging' &&
github.event.pull_request.base.ref != 'main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check for changeset
run: |
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
if echo "$LABELS" | jq -e 'index("skip-changeset") != null' > /dev/null 2>&1; then
echo "Label 'skip-changeset' found — bypassing."
exit 0
fi
CHANGED=$(git diff --name-only "origin/${{ github.base_ref }}...HEAD" \
| grep '^\.changeset/.*\.md$' | grep -v 'README\.md' || true)
if [ -z "$CHANGED" ]; then
echo "::error::No changeset found. Run: npx changeset"
echo "Or add label 'skip-changeset' for infra-only changes."
exit 1
fi
echo "Changeset found: $CHANGED"