Unverified Commit 6523c0d2 authored by Philip Taron's avatar Philip Taron Committed by GitHub
Browse files

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

parents fb9d2da9 b98ea083
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -39,6 +39,10 @@ jobs:
  update:
    runs-on: ubuntu-24.04-arm
    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:
      - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
        with:
+6 −29
Original line number Diff line number Diff line
@@ -72,20 +72,7 @@ module.exports = async ({ github, context, core, dry }) => {
          exclude_pull_requests: true,
          head_sha: pull_request.head.sha,
        })
      ).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] ??
      {}
      ).data.workflow_runs[0] ?? {}

    // Newer PRs might not have run Eval to completion, 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'),
      ).labels

      Object.assign(
        prLabels,
        // Ignore `evalLabels` if it's an array.
        // 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),
          ),
        },
      )
      Object.assign(prLabels, evalLabels, {
        '12.approved-by: package-maintainer':
          maintainers.intersection(approvals).size > 0,
      })
    }

    return prLabels
@@ -372,7 +349,7 @@ module.exports = async ({ github, context, core, dry }) => {
            `updated:>=${cutoff.toISOString()}`,
          ].join(' AND '),
          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,
        },
      )