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

Aberta Para iniciantes
#2,424 0 comentários 0 reações 0 responsáveis Ver no GitHub

Mantenedores costumam responder em até 1 dia

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
78/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Ativa
Stack de tecnologia
github-actions, typescript

Direção de pesquisa

Comece por scripts/pr-readiness.mjs e leia run(), onde o PR é carregado e a referência base e os rótulos são selecionados. Em seguida, encontre os testes existentes para run() e adicione um caso com fetchFn simulado que cubra uma base de snapshot dev em comparação com a base ativa main, além de um rótulo ativo skip-changelog. O trabalho estará concluído quando a comparação usar main e o rótulo afetar a verificação do changeset; execute o teste relevante.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

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.
Linguagem predominante
TypeScript
Estrelas
3.4k
Forks
516
Merge médio
1d 15h
PRs com merge (30d)
116

Preparar o ambiente

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de github/squad

Todas as issues de github/squad

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.