-
Notifications
You must be signed in to change notification settings - Fork 2k
Restrict /review rerun eligibility to author activity #35874
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
129b09d
7aa823e
ace4373
6579016
3939e24
f264273
0e519c1
df5f314
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,7 +83,7 @@ $searchResult = gh pr list ` | |
| --state open ` | ||
| --label $ReadyForRerunLabel ` | ||
| --limit $MaxPRs ` | ||
| --json number,title,url,headRefOid,isDraft,labels | ConvertFrom-Json | ||
| --json number,title,url,headRefOid,isDraft,labels,author | ConvertFrom-Json | ||
|
|
||
| $candidates = @() | ||
| foreach ($pr in @($searchResult)) { | ||
|
|
@@ -101,14 +101,16 @@ foreach ($pr in @($searchResult)) { | |
| $latestRerun = Get-LatestRerunComment -Comments $activity | ||
| $reviewOptionAuthors = @(Get-ReviewOptionAuthorLogins -Comments $activity) | ||
| $reviewOptions = Get-LatestReviewCommandOptions -Comments $activity -AllowedAuthorLogins $reviewOptionAuthors | ||
| $contextMarkdown = New-RerunContextMarkdown -Comments $activity -Commits $commits -CurrentHeadSha $pr.headRefOid -CurrentLabels $labels | ||
| $authorLogin = if ($pr.author -and $pr.author.login) { [string]$pr.author.login } else { '' } | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Here Practical impact is bounded (one reviewer overstated this as ❌; verified): the deterministic eligibility gate invoked from Suggested fix: either resolve the author via REST inside the loop (one extra API call per candidate; cheap given |
||
| $contextMarkdown = New-RerunContextMarkdown -Comments $activity -Commits $commits -CurrentHeadSha $pr.headRefOid -PRAuthorLogin $authorLogin -CurrentLabels $labels | ||
| $platform = if ($reviewOptions.Platform) { $reviewOptions.Platform } else { Get-PlatformFromLabels -Labels $labels } | ||
| $pipelineRef = if ($reviewOptions.PipelineRef) { $reviewOptions.PipelineRef } else { 'main' } | ||
|
|
||
| $candidates += [pscustomobject]@{ | ||
| prNumber = $number | ||
| title = [string]$pr.title | ||
| url = [string]$pr.url | ||
| authorLogin = $authorLogin | ||
| isDraft = [bool]$pr.isDraft | ||
| headSha = [string]$pr.headRefOid | ||
| platform = $platform | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new defensive PR fetch combined with the
exit 0added at line 412 is too broad.gh api ... 2>$nullfollowed by$global:LASTEXITCODE = 0andcontinuetreats everyghfailure (auth expired, secondary rate limit, transient 5xx, malformed JSON) identically to "PR was deleted / 404". The step then keeps iterating, swallows the error, andexit 0reports the whole safe-output job green.Under a real systemic failure (PAT/App token rotated mid-run, GitHub outage, secondary rate limit while a large queue is draining), every queued rerun decision is silently skipped without surfacing the underlying cause — operators see a clean green run while no actual reruns fire. That's exactly the failure shape this script is supposed to convert into a visible error.
Suggested fix: distinguish stale-PR from transient/credential failures. Capture stderr (don't drop it), and only short-circuit when the response indicates a known stale status (e.g., 404/410, gone, not found). For 401/403/5xx/secondary-rate-limit, surface the error and let the step fail visibly. Alternatively, accumulate a per-iteration error count and
exit 1at the bottom if any candidate failed for non-stale reasons.