Skip to content

fix(trigger): fall back to rerun when approve fails for non-fork PRs - #798

Open
cblecker wants to merge 2 commits into
kubernetes-sigs:mainfrom
cblecker:fix-ok-to-test-non-fork-approval
Open

fix(trigger): fall back to rerun when approve fails for non-fork PRs#798
cblecker wants to merge 2 commits into
kubernetes-sigs:mainfrom
cblecker:fix-ok-to-test-non-fork-approval

Conversation

@cblecker

@cblecker cblecker commented Jul 14, 2026

Copy link
Copy Markdown
Member

Summary

  • The GitHub Actions approve endpoint only works for fork PRs. When a same-repo PR is created by a bot (e.g. github-actions[bot]), workflow runs enter action_required status but the approve endpoint returns 403. Previously this was logged as a warning about token scopes and silently swallowed, so /ok-to-test appeared to do nothing for GitHub Actions workflows on bot-created PRs.
  • Now when approve returns 403, we fall back to the rerun endpoint which changes the triggering_actor to the API caller and bypasses the approval gate.
  • Also returns a sync.WaitGroup from approveGitHubActionsWorkflowRuns so tests can reliably wait for goroutine completion instead of using time.Sleep.

References:

Note: this PR was created with the assistance of AI tooling

@netlify

netlify Bot commented Jul 14, 2026

Copy link
Copy Markdown

Deploy Preview for k8s-prow ready!

Name Link
🔨 Latest commit dd76a90
🔍 Latest deploy log https://app.netlify.com/projects/k8s-prow/deploys/6a56e72b6c6d4800083561d7
😎 Deploy Preview https://deploy-preview-798--k8s-prow.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@kubernetes-prow kubernetes-prow Bot added cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/L Denotes a PR that changes 100-499 lines, ignoring generated files. area/plugins Issues or PRs related to prow's plugins for the hook component labels Jul 14, 2026
@kubernetes-prow kubernetes-prow Bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jul 14, 2026
cblecker added 2 commits July 14, 2026 18:49
The GitHub Actions approve endpoint only works for fork PRs. When a
same-repo PR is created by a bot (e.g. github-actions[bot]), workflow
runs enter action_required status but the approve endpoint returns 403.
Previously this was logged as a token scope warning and silently
swallowed.

Now when approve returns 403, we fall back to the rerun endpoint which
changes the triggering_actor to the API caller and bypasses the approval
gate.

Also returns a sync.WaitGroup from approveGitHubActionsWorkflowRuns so
tests can reliably wait for goroutine completion instead of using
time.Sleep.
@cblecker
cblecker force-pushed the fix-ok-to-test-non-fork-approval branch from 2193d3c to dd76a90 Compare July 15, 2026 01:49
@kubernetes-prow kubernetes-prow Bot added area/deck Issues or PRs related to prow's deck component area/spyglass Issues or PRs related to prow's spyglass UI area/tide Issues or PRs related to prow's tide component and removed approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jul 15, 2026
@kubernetes-prow

Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: cblecker, Prucek
Once this PR has been reviewed and has the lgtm label, please assign smg247, stevekuznetsov for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@kubernetes-prow kubernetes-prow Bot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/deck Issues or PRs related to prow's deck component area/plugins Issues or PRs related to prow's plugins for the hook component area/spyglass Issues or PRs related to prow's spyglass UI area/tide Issues or PRs related to prow's tide component cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants