Skip to content

PR readiness: base ref and labels come from the bind snapshot instead of the live PR #2424

Open

Description

@tamirdresher

Found by: github-integration-dev while fixing a Copilot review finding on #2423 (the #2420 fix). This is outside that PR's scope, so it's tracked here.

Problem

scripts/pr-readiness.mjs run() takes the PR's base ref and labels from environment variables. The bind job sets them from the event snapshot:

  • PR_BASE_REF (line ~471) is used for the "Branch up to date" comparison (compare/<base>...<head>), the checklist text and the links in the comment footer.
  • PR_LABELS (line ~476) feeds "Changeset present", which honours the skip-changelog label.

run() already reads the live PR (GET /pulls/{n}), and that response contains base.ref and labels. Neither is used.

Once #2423 lands, runs for the same PR head share one concurrency group with cancel-in-progress: true. A late delivery from before a base change (an edited event) can therefore cancel the newer run for that head and post a checklist against the old base. A label change has the same effect when it is followed by a refresh for the same head. Stale-head deliveries are not affected: #2423 makes them write nothing.

Suggested fix

In run():

  1. Prefer prData.base.ref and prData.labels[].name from the live PR read. Fall back to the environment values only when that read fails, the same way draft status already prefers API truth (prData?.draft ?? prDraft).
  2. Add a regression test with a mocked fetchFn: a snapshot base of dev and a live base of main must compare against main, and a live skip-changelog label must count when the snapshot lacks it.

Notes

  • The request workflow does not trigger on labeled/unlabeled, so a label change alone doesn't refresh the checklist. This issue is only about using live values when a refresh does run.
  • Low impact: the checklist is advisory, and the next PR event corrects it.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions