1212
1313permissions :
1414 contents : write # push the changeset commit
15- actions : write # dispatch repo.yaml on the new head
1615
1716concurrency :
1817 group : ' ${{ github.workflow }}-${{ github.head_ref }}'
@@ -23,10 +22,13 @@ jobs:
2322 name : Generate changeset
2423 runs-on : ubuntu-latest
2524 # Only same-repo PRs authored by dependabot. PR author (not actor) so a
26- # human reopening/rebasing the PR still gets a changeset regenerated.
25+ # human reopening/rebasing the PR still gets a changeset regenerated, but
26+ # never react to our own changeset commit (sender is the pusher on
27+ # `synchronize`, and the commit below is made as github-actions[bot]).
2728 if : >
2829 github.event.pull_request.user.login == 'dependabot[bot]' &&
29- github.event.pull_request.head.repo.full_name == github.repository
30+ github.event.pull_request.head.repo.full_name == github.repository &&
31+ github.event.sender.login != 'github-actions[bot]'
3032 steps :
3133 - uses : actions/checkout@v4
3234 with :
8486 git commit -m 'Sync changeset with Dependabot update'
8587 git push origin "HEAD:$HEAD_REF"
8688 echo 'pushed=true' >>"$GITHUB_OUTPUT"
87-
88- # A push made with GITHUB_TOKEN does not re-trigger pull_request
89- # workflows, so the new head commit would show no checks. Explicit
90- # workflow_dispatch is exempt from that rule and attaches its check
91- # runs to the new head commit.
92- - name : Re-run CI on the new head
93- if : steps.generate.outputs.pushed == 'true'
94- env :
95- GH_TOKEN : ${{ github.token }}
96- HEAD_REF : ${{ github.event.pull_request.head.ref }}
97- run : gh workflow run repo.yaml --repo "$GITHUB_REPOSITORY" --ref "$HEAD_REF"
0 commit comments