fix(actions): run review-triggered workflows on the pull request head (#40099)

Runs triggered by pull request reviews took their ref and commit from
the review's `commit_id` instead of the pull request. They now use the
pull request head like other pull request events, and their commit
status is set on the commit that ran.
This commit is contained in:
silverwind authored and GitHub committed 2026-10-31 12:48:26 +00:00
1 parent 405ba258a8
commit b89fcf7496
5 files changed
+9 -23

No files matched your search

+2 -12
View File
@@ -116,21 +116,11 @@ func getCommitStatusEventNameAndCommitID(run *actions_model.ActionRun) (event, c
return "", "", errors.New("head of pull request is missing in event payload")
}
commitID = payload.PullRequest.Head.Sha
case // pull_request_review events share the same PullRequestPayload as pull_request
webhook_module.HookEventPullRequestReviewApproved,
case webhook_module.HookEventPullRequestReviewApproved,
webhook_module.HookEventPullRequestReviewRejected,
webhook_module.HookEventPullRequestReviewComment:
event = run.TriggerEvent
payload, err := run.GetPullRequestEventPayload()
if err != nil {
return "", "", fmt.Errorf("GetPullRequestEventPayload: %w", err)
}
if payload.PullRequest == nil {
return "", "", errors.New("pull request is missing in event payload")
} else if payload.PullRequest.Head == nil {
return "", "", errors.New("head of pull request is missing in event payload")
}
commitID = payload.PullRequest.Head.Sha
commitID = run.CommitSHA
case webhook_module.HookEventRelease:
event = string(run.Event)
commitID = run.CommitSHA