-
Notifications
You must be signed in to change notification settings - Fork 11
55 lines (51 loc) · 2.15 KB
/
Copy pathchangeset.yml
File metadata and controls
55 lines (51 loc) · 2.15 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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
name: Changeset
# Every pull request that changes the shipped package must carry a
# `.changeset/*.md` entry. Separate from ci.yml so toggling the
# `skip-changeset` label re-evaluates only this check.
on:
pull_request:
types: [opened, synchronize, reopened, labeled, unlabeled]
permissions:
contents: read
concurrency:
group: changeset-${{ github.event.pull_request.number }}
cancel-in-progress: true
jobs:
changeset:
name: Changeset present
runs-on: ubuntu-22.04
timeout-minutes: 10
steps:
# `changeset status --since=origin/main` diffs against the merge-base.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
with:
fetch-depth: 0
persist-credentials: false
- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7
with:
node-version: "24"
- run: npm ci
- name: Require a changeset for shipped-package changes
shell: bash
env:
SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'skip-changeset') }}
# Only the machine-owned release branch of this repository is exempt.
IS_RELEASE_BRANCH: >-
${{ github.event.pull_request.head.ref == 'changeset-release/main' &&
github.event.pull_request.head.repo.full_name == github.repository }}
run: |
set -euo pipefail
if [ "$SKIP_LABEL" = "true" ]; then
echo "::notice::skip-changeset label present; not requiring a changeset."
exit 0
fi
if [ "$IS_RELEASE_BRANCH" = "true" ]; then
echo "::notice::Release branch; changesets are consumed here, not added."
exit 0
fi
# Exit 1 when a shipped file changed (changedFilePatterns in
# .changeset/config.json) and this PR adds no .changeset/*.md.
if ! npx changeset status --since=origin/main --verbose; then
echo "::error::This PR changes grok-bot-cli's shipped surface without a changeset. Run 'npx changeset' (or add .changeset/<slug>.md). For a genuinely no-op change, apply the 'skip-changeset' label."
exit 1
fi