Skip to content

Commit 94d99ad

Browse files
committed
fix: use App token for auto-merge to unblock post-merge events
When GITHUB_TOKEN enables auto-merge, the resulting merge is attributed to github-actions[bot]. GitHub suppresses all events from GITHUB_TOKEN, so the pull_request:closed and push events never fire. This prevents the post-merge workflow from running (no auto-update of open PR branches, no CI/security/scorecard triggers on main). Fix: use the patchloom-release App token for gh pr merge --auto. Events from GitHub App tokens are not suppressed, so post-merge triggers correctly. Also skips both the token generation and auto-merge steps for release PRs (patchloom-release[bot] author) so the maintainer controls release timing. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent 6613770 commit 94d99ad

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

.github/workflows/auto-approve.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,15 @@ jobs:
3232

3333
- uses: hmarr/auto-approve-action@f0939ea97e9205ef24d872e76833fa908a770363 # v4.0.0
3434

35+
- uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
36+
if: github.event.pull_request.user.login != 'patchloom-release[bot]'
37+
id: app-token
38+
with:
39+
app-id: ${{ secrets.APP_ID }}
40+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
41+
3542
- name: Enable auto-merge
3643
if: github.event.pull_request.user.login != 'patchloom-release[bot]'
3744
env:
38-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
45+
GH_TOKEN: ${{ steps.app-token.outputs.token }}
3946
run: gh pr merge --auto --squash "${{ github.event.pull_request.number }}" --repo "${{ github.repository }}"

0 commit comments

Comments
 (0)