Skip to content

Commit 1998f3c

Browse files
committed
ci(changeset): disallow major release [AR-44378]
1 parent 65047b3 commit 1998f3c

1 file changed

Lines changed: 29 additions & 0 deletions

File tree

.github/workflows/changeset.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,32 @@ jobs:
5454
# See: https://github.com/changesets/changesets/blob/main/docs/automating-changesets.md#blocking
5555
- name: Run Changesets
5656
run: pnpm changeset status --since origin/main
57+
58+
disallow-major:
59+
- name: Disallow Major Release
60+
runs-on: ubuntu-latest
61+
62+
permissions:
63+
contents: read
64+
65+
# Skip opted out PRs, and release PRs
66+
if: |
67+
! contains(github.event.pull_request.labels.*.name, 'skip changelog') &&
68+
! (github.event.pull_request.title == 'chore(release): publish' && github.event.pull_request.user.login == 'github-actions[bot]')
69+
70+
steps:
71+
- name: Checkout source code
72+
uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
73+
with:
74+
fetch-depth: 0
75+
persist-credentials: false
76+
77+
- name: Check for Major Changeset
78+
run: |
79+
STATUS_OUTPUT=$(pnpm changeset status --since origin/main)
80+
MAJOR_PATTERN="info Packages to be bumped at major:"
81+
82+
if [[ "$STATUS_OUTPUT" == *"$MAJOR_PATTERN"* ]]; then
83+
echo "Error: Major changesets are not allowed. Did you mean to create a minor or patch changeset instead?";
84+
exit 1;
85+
fi

0 commit comments

Comments
 (0)