fix(ci): trigger required checks on automated PRs#1173
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: Close/reopen with GITHUB_TOKEN won't trigger workflows
- Replaced the close/reopen approach with
gh workflow run ci.yml --refwhich uses the workflow_dispatch event that is explicitly exempted from the GITHUB_TOKEN limitation, and added the requiredactions: writepermission.
- Replaced the close/reopen approach with
Preview (c6edf405b5)
diff --git a/.github/workflows/weekly-update.yml b/.github/workflows/weekly-update.yml
--- a/.github/workflows/weekly-update.yml
+++ b/.github/workflows/weekly-update.yml
@@ -59,6 +59,7 @@
if: needs.check-updates.outputs.has-updates == 'true' && inputs.dry-run != true
runs-on: ubuntu-latest
permissions:
+ actions: write
contents: write
pull-requests: write
steps:
@@ -293,6 +294,17 @@
--head "$BRANCH_NAME" \
--base main
+ # Events triggered by GITHUB_TOKEN don't create new workflow runs,
+ # with the exception of workflow_dispatch and repository_dispatch.
+ # Use workflow_dispatch to trigger CI on the newly pushed branch.
+ - name: Trigger CI checks
+ if: steps.final.outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
+ env:
+ GH_TOKEN: ${{ github.token }}
+ BRANCH_NAME: ${{ steps.branch.outputs.branch }}
+ run: |
+ gh workflow run ci.yml --ref "$BRANCH_NAME"
+
- name: Add job summary
if: steps.final.outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true'
env:You can send follow-ups to the cloud agent here.
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit 147375f. Configure here.
| - name: Trigger CI checks | ||
| if: steps.final.outputs.success == 'true' && steps.validate.outputs.valid == 'true' && steps.changes.outputs.has-changes == 'true' | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} |
There was a problem hiding this comment.
Close/reopen with GITHUB_TOKEN won't trigger workflows
High Severity
The "Trigger CI checks" step uses GH_TOKEN: ${{ github.token }} (the GITHUB_TOKEN) to close and reopen the PR. However, GitHub's documentation states that events triggered by the GITHUB_TOKEN — including pull_request.reopened — will not create new workflow runs. This is the exact same limitation the comment on line 296 describes for pushes. The close/reopen cycle will succeed but the resulting event will be silently ignored, so the required CI checks will still never be triggered. A PAT or GitHub App installation token is needed instead.
Reviewed by Cursor Bugbot for commit 147375f. Configure here.
The close/reopen approach used GITHUB_TOKEN which cannot trigger workflow runs (GitHub limitation applies to all events except workflow_dispatch and repository_dispatch). Replace with gh workflow run ci.yml which uses the exempted workflow_dispatch event. Add actions:write permission required for workflow_dispatch.


Summary
GITHUB_TOKENdon't trigger other GitHub Actions workflows. This causes required CI and enterprise audit checks to get stuck at "Waiting for workflow to run" on automated PRs created by the weekly update workflow.weekly-update.ymlto generate apull_request.reopenedevent, which triggers the required workflows.Test plan
workflow_dispatchand verify CI checks are triggered on the resulting PRNote
Medium Risk
Medium risk because it changes GitHub Actions behavior for automated PRs and temporarily closes/reopens them, which could affect notifications, branch protections, or downstream automation.
Overview
Ensures automated PRs created by
weekly-update.ymlreliably trigger required CI and enterprise audit workflows.After creating the dependency-update PR, the workflow now looks up the PR by head branch and performs a close/reopen cycle to emit a
pull_request.reopenedevent (working around the fact that pushes made withGITHUB_TOKENdon’t start other workflows).Reviewed by Cursor Bugbot for commit 147375f. Configure here.