-
Notifications
You must be signed in to change notification settings - Fork 5
31 lines (29 loc) · 1.07 KB
/
changeset.yml
File metadata and controls
31 lines (29 loc) · 1.07 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
name: changeset
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
jobs:
require-changeset:
runs-on: ubuntu-latest
if: ${{ !contains(github.event.pull_request.labels.*.name, 'skip-changeset') }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Verify a changeset was added
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
added=$(git diff --name-only --diff-filter=A "$BASE_SHA" "$HEAD_SHA" \
| grep -E '^\.changeset/[^/]+\.md$' \
| grep -v '^\.changeset/HOWTO\.md$' || true)
if [ -z "$added" ]; then
echo "No changeset added under .changeset/."
echo "Run ./changeset.sh \"Short description\" and commit the result,"
echo "or add the 'skip-changeset' label if no user-visible change."
exit 1
fi
echo "Found changeset(s):"
echo "$added"