Skip to content

Commit

Permalink
temp: get patch versions via changeset status JSON output
Browse files Browse the repository at this point in the history
  • Loading branch information
angusbayley committed Oct 31, 2024
1 parent 06dd4fd commit b7fde79
Showing 1 changed file with 22 additions and 5 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/changeset-enforce.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,36 @@ jobs:
runs-on: ubuntu-22.04

steps:
- name: Checkout repository
- name: Checkout repository (feature branch)
uses: actions/checkout@v4
with:
ref: ${{ github.head_ref }}
fetch-depth: 1
sparse-checkout: |
.changeset

- name: Checkout repository (develop branch)
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 1

- uses: pnpm/action-setup@v4
with:
version: 9.11.0

- name: Install changesets
# run: pnpm install -w @changesets/cli --no-frozen-lockfile
run: pnpm add -g @changesets/cli

- name: Generate changeset status
run: pnpm changeset status --output=changeset-status.json

- name: Check for patch level changesets
run: |
if grep -r ": patch" .changeset/*.md; then
echo "❌ Patch level changesets are reserved for hotfixes, use major or minor only."
PATCH_CHANGESET_IDS=$(jq -r '.changesets[] | select(.releases[].type == "patch") | .id' changeset-status.json)
if [ -n "$PATCH_CHANGESET_IDS" ]; then
echo "Patch changesets found:"
echo "$PATCH_CHANGESET_IDS"
echo "❌ Patch level changesets are reserved for hotfixes, use major or minor only"
exit 1
else
echo "✅ No patch level changesets found."
Expand Down

0 comments on commit b7fde79

Please sign in to comment.