Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: ensure changeset PR deletes all changesets #2166

Merged
merged 8 commits into from
May 8, 2024
2 changes: 2 additions & 0 deletions .changeset/famous-olives-shake.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
---
nedsalk marked this conversation as resolved.
Show resolved Hide resolved
17 changes: 17 additions & 0 deletions .github/workflows/pr-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ jobs:
# e.g. when a script is added in the scripts folder
exit 0
fi
echo "CHANGESET_FILE=$(echo "$CHANGESET_FILE")" >> $GITHUB_ENV
nedsalk marked this conversation as resolved.
Show resolved Hide resolved

AFFECTED_PACKAGES=$(sed -n '/---/,/---/p' "$CHANGESET_FILE" | sed '/---/d')

Expand All @@ -104,6 +105,22 @@ jobs:
env:
PR_TITLE: ${{ github.event.pull_request.title }}

- name: Validate added changeset will be deleted
if: ${{ env.CHANGESET_FILE != '' }}
run: |
pnpm changeset version

if git status --porcelain .changeset | grep -q "D $CHANGESET_FILE"; then
git reset --hard
exit 0
fi

# Throw if changeset not in deleted changesets
echo "Changeset file $CHANGESET_FILE will not get deleted in the changesets PR. Check its affected packages."
exit 1
env:
CHANGESET_FILE: ${{ env.CHANGESET_FILE }}

- name: Validate that there are only patch changes
if: startsWith(github.base_ref, 'release/')
run: |
Expand Down