···133 pull_number
134 })).data
135136- const approvals = new Set(
137- (await github.paginate(github.rest.pulls.listReviews, {
138 ...context.repo,
139 pull_number
140- }))
000141 .filter(review => review.state == 'APPROVED')
142 .map(review => review.user?.id)
143 )
···169 [ 'NONE', 'FIRST_TIMER', 'FIRST_TIME_CONTRIBUTOR' ].includes(pull_request.author_association),
170 }
171172- const run_id = (await github.rest.actions.listWorkflowRuns({
173 ...context.repo,
174 workflow_id: 'pr.yml',
175 event: 'pull_request_target',
176 exclude_pull_requests: true,
177 head_sha: pull_request.head.sha
178- })).data.workflow_runs[0]?.id ??
179 // TODO: Remove this after 2025-09-17, at which point all eval.yml artifacts will have expired.
180 (await github.rest.actions.listWorkflowRuns({
181 ...context.repo,
···185 status: 'success',
186 exclude_pull_requests: true,
187 head_sha: pull_request.head.sha
188- })).data.workflow_runs[0]?.id
189190 // Newer PRs might not have run Eval to completion, yet.
191 // Older PRs might not have an eval.yml workflow, yet.
192 // In either case we continue without fetching an artifact on a best-effort basis.
193 log('Last eval run', run_id ?? '<n/a>')
00000000000000000194195 const artifact = run_id && (await github.rest.actions.listWorkflowRunArtifacts({
196 ...context.repo,
···133 pull_number
134 })).data
135136+ const reviews = await github.paginate(github.rest.pulls.listReviews, {
0137 ...context.repo,
138 pull_number
139+ })
140+141+ const approvals = new Set(
142+ reviews
143 .filter(review => review.state == 'APPROVED')
144 .map(review => review.user?.id)
145 )
···171 [ 'NONE', 'FIRST_TIMER', 'FIRST_TIME_CONTRIBUTOR' ].includes(pull_request.author_association),
172 }
173174+ const { id: run_id, conclusion } = (await github.rest.actions.listWorkflowRuns({
175 ...context.repo,
176 workflow_id: 'pr.yml',
177 event: 'pull_request_target',
178 exclude_pull_requests: true,
179 head_sha: pull_request.head.sha
180+ })).data.workflow_runs[0] ??
181 // TODO: Remove this after 2025-09-17, at which point all eval.yml artifacts will have expired.
182 (await github.rest.actions.listWorkflowRuns({
183 ...context.repo,
···187 status: 'success',
188 exclude_pull_requests: true,
189 head_sha: pull_request.head.sha
190+ })).data.workflow_runs[0] ?? {}
191192 // Newer PRs might not have run Eval to completion, yet.
193 // Older PRs might not have an eval.yml workflow, yet.
194 // In either case we continue without fetching an artifact on a best-effort basis.
195 log('Last eval run', run_id ?? '<n/a>')
196+197+ if (conclusion === 'success') {
198+ Object.assign(prLabels, {
199+ // We only set this label if the latest eval run was successful, because if it was not, it
200+ // *could* have requested reviewers. We will let the PR author fix CI first, before "escalating"
201+ // this PR to "needs: reviewer".
202+ // Since the first Eval run on a PR always sets rebuild labels, the same PR will be "recently
203+ // updated" for the next scheduled run. Thus, this label will still be set within a few minutes
204+ // after a PR is created, if required.
205+ // Note that a "requested reviewer" disappears once they have given a review, so we check
206+ // existing reviews, too.
207+ '9.needs: reviewer':
208+ !pull_request.draft &&
209+ pull_request.requested_reviewers.length == 0 &&
210+ reviews.length == 0,
211+ })
212+ }
213214 const artifact = run_id && (await github.rest.actions.listWorkflowRunArtifacts({
215 ...context.repo,