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

Abierto Apto para principiantes
#2,424 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
78/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github-actions, typescript

Línea de trabajo

Empieza con scripts/pr-readiness.mjs y lee run(), donde carga el PR y selecciona la referencia base y las etiquetas. Luego busca las pruebas existentes para run() y añade un caso con fetchFn simulado que cubra una base de instantánea dev frente a la base en vivo main, además de una etiqueta en vivo skip-changelog. Se considera terminado cuando la comparación usa main y la etiqueta afecta a la comprobación de changesets; ejecuta la prueba pertinente.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.
Lenguaje dominante
TypeScript
Estrellas
3.4k
Forks
516
Merge medio
1 d 15 h
PR fusionados (30 d)
116

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de github/squad

Todos los issues de github/squad

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.