Skip to content

Commit a482560

Browse files
committed
fix: push empty commit on changesets PR to trigger CI checks
The changesets action creates the PR using the bot token (GITHUB_TOKEN), which doesn't trigger CI checks. After PR creation, push an empty commit using the PAT so checks run automatically.
1 parent cb66b56 commit a482560

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/changesets.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,18 @@ jobs:
4848
env:
4949
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5050

51+
- name: Trigger checks on PR branch
52+
if: steps.changesets.outputs.pullRequestNumber
53+
run: |
54+
PR_BRANCH=$(gh pr view ${{ steps.changesets.outputs.pullRequestNumber }} --json headRefName -q '.headRefName')
55+
git remote set-url origin https://x-access-token:${{ secrets.CHANGESETS_TOKEN }}@github.com/${{ github.repository }}
56+
git fetch origin "$PR_BRANCH"
57+
git checkout "$PR_BRANCH"
58+
git commit --allow-empty -m "chore: trigger CI checks"
59+
git push origin "$PR_BRANCH"
60+
env:
61+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
62+
5163
- name: Add release label to PR
5264
if: steps.changesets.outputs.pullRequestNumber
5365
run: gh pr edit ${{ steps.changesets.outputs.pullRequestNumber }} --add-label release

0 commit comments

Comments
 (0)