workflows/labels: fix on older PRs

When we made the switch from eval.yml to pr.yml we adjusted the labels
job as well - but didn't take into account that we also need to deal
with old PRs at the same time.

Here, we fallback to another API request to get a run for eval.yml when
we can't find one for pr.yml.

(cherry picked from commit d00d3190d6)
This commit is contained in:
Wolfgang Walther
2025-06-20 21:03:45 +02:00
committed by github-actions[bot]
parent c67dc2d76d
commit 8e0587dd8f

View File

@@ -152,7 +152,17 @@ jobs:
status: prEventCondition ? 'in_progress' : 'success',
exclude_pull_requests: true,
head_sha: pull_request.head.sha
})).data.workflow_runs[0]?.id
})).data.workflow_runs[0]?.id ??
// TODO: Remove this after 2025-09-17, at which point all eval.yml artifacts will have expired.
(await github.rest.actions.listWorkflowRuns({
...context.repo,
// In older PRs, we need eval.yml instead of pr.yml.
workflow_id: 'eval.yml',
event: 'pull_request_target',
status: 'success',
exclude_pull_requests: true,
head_sha: pull_request.head.sha
})).data.workflow_runs[0]?.id
// Newer PRs might not have run Eval to completion, yet. We can skip them, because this
// job will be run as part of that Eval run anyway.