ci/github-script/labels: solve TODOs (#451950)

This commit is contained in:
Philip Taron
2025-10-14 13:41:48 +00:00
committed by GitHub
2 changed files with 10 additions and 29 deletions

View File

@@ -39,6 +39,10 @@ jobs:
update: update:
runs-on: ubuntu-24.04-arm runs-on: ubuntu-24.04-arm
if: github.event_name != 'schedule' || github.repository_owner == 'NixOS' if: github.event_name != 'schedule' || github.repository_owner == 'NixOS'
env:
# TODO: Remove after 2026-03-04, when Node 24 becomes the default.
# https://github.blog/changelog/2025-09-19-deprecation-of-node-20-on-github-actions-runners/
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
steps: steps:
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with: with:

View File

@@ -72,20 +72,7 @@ module.exports = async ({ github, context, core, dry }) => {
exclude_pull_requests: true, exclude_pull_requests: true,
head_sha: pull_request.head.sha, head_sha: pull_request.head.sha,
}) })
).data.workflow_runs[0] ?? ).data.workflow_runs[0] ?? {}
// 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] ??
{}
// Newer PRs might not have run Eval to completion, yet. // Newer PRs might not have run Eval to completion, yet.
// Older PRs might not have an eval.yml workflow, yet. // Older PRs might not have an eval.yml workflow, yet.
@@ -159,20 +146,10 @@ module.exports = async ({ github, context, core, dry }) => {
await readFile(`${pull_number}/changed-paths.json`, 'utf-8'), await readFile(`${pull_number}/changed-paths.json`, 'utf-8'),
).labels ).labels
Object.assign( Object.assign(prLabels, evalLabels, {
prLabels, '12.approved-by: package-maintainer':
// Ignore `evalLabels` if it's an array. maintainers.intersection(approvals).size > 0,
// This can happen for older eval runs, before we switched to objects. })
// The old eval labels would have been set by the eval run,
// so now they'll be present in `before`.
// TODO: Simplify once old eval results have expired (~2025-10)
Array.isArray(evalLabels) ? undefined : evalLabels,
{
'12.approved-by: package-maintainer': Array.from(maintainers).some(
(m) => approvals.has(m),
),
},
)
} }
return prLabels return prLabels
@@ -372,7 +349,7 @@ module.exports = async ({ github, context, core, dry }) => {
`updated:>=${cutoff.toISOString()}`, `updated:>=${cutoff.toISOString()}`,
].join(' AND '), ].join(' AND '),
per_page: 100, per_page: 100,
// TODO: Remove in 2025-10, when it becomes the default. // TODO: Remove after 2025-11-04, when it becomes the default.
advanced_search: true, advanced_search: true,
}, },
) )