Opening a PR right after pushing runs the dry run twice and posts two comments

Abierto
#1,139 2 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 2 días

Nadie ha tomado este issue todavía.

  • #1140 de @TovaBecker — cerrado sin fusionar

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
66/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
github, javascript
Área
ci-cd, devtools

Línea de trabajo

Start in index.js and trace the check_suite.requested and pull_request.opened handlers into createCheckRun. Check how existing “Safe-setting validator” check runs for the same head_sha can be found, then add or run focused coverage for the push and PR opening arriving close together. Done means one dry run and one PR comment per commit.

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

Descripción

Problem

When a PR is opened within a few seconds of pushing its branch, safe-settings creates two "Safe-setting validator" check runs on the same commit. Both run the dry run, and each posts its own PR comment, so the PR gets two identical comments.

Seen on 3.0.0 (df84f83): two check runs on the same head commit, started 3 seconds apart, and two identical comments.

Cause

Two handlers in index.js call createCheckRun for the same commit:

  1. check_suite.requested fires on the push. If the PR already exists, the payload lists it, so a check run is created.
  2. pull_request.opened fires when the PR is created and always creates a check run.

When the PR is created right after the push (for example gh pr create, or Create pull request right after committing in the web editor), both events see the PR.

Expected

One dry run and one comment per commit.

Possible fix

In createCheckRun, skip creating a check run if a "Safe-setting validator" check run already exists for the same head_sha.

Related: #737 (same symptom after a later push), #1015 (check_suite.rerequested is registered twice, so a re-run can also run twice).

Lenguaje dominante
JavaScript
Estrellas
942
Forks
238
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Abrir en Codespaces

Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.

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-community-projects/safe-settings

Todos los issues de github-community-projects/safe-settings

Issues similares

Más issues de JavaScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.