Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

[BUG]: cleanup-pr-previews never removes previews of deleted PRs

Ouverte Adaptée aux débutants
#2,952 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 1 jour

Personne n'a encore pris cette issue.

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
84/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
github, github-actions, shell
Domaine
ci-cd, devops

Piste de recherche

Commencez par ci/cleanup-pr-previews autour des lignes 137-139 et exécutez la commande dry-run documentée depuis la racine du dépôt. Reproduisez le comportement 404 du PR #2308, puis vérifiez que la gestion du statut distingue un PR supprimé des autres échecs de l'API et ne supprime que le dossier de preview approprié.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

triage
Is this a duplicate?
Type of Bug

Silent Failure

Component

Infrastructure

Describe the bug

ci/cleanup-pr-previews is supposed to remove preview folders for closed, merged, and deleted PRs. The deleted-PR case never matches.

For a PR that no longer exists, gh api ... --jq '.state' exits non-zero but still prints the 404 JSON body to stdout. The || echo "not_found" fallback is then appended to that output instead of replacing it:

https://github.com/NVIDIA/cuda-python/blob/f9ed2bdaede7b66e6323dc7772a93953af39dfc7/ci/cleanup-pr-previews#L137-L139

PR_STATUS becomes {"message":"Not Found",...}not_found. That falls through to the *) branch, which logs UNKNOWN and keeps the folder.

This is happening now with docs/pr-preview/pr-2308 on gh-pages. #2308 no longer exists (both the pulls and issues endpoints return 404), and its preview has been there since 2026-07-07. The last scheduled run logged:

[UNKNOWN] PR #2308 has unexpected status: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/pulls/pulls#get-a-pull-request","status":"404"}not_found
...
Folders to remove: 0

https://github.com/NVIDIA/cuda-python/actions/runs/36217108226

How to Reproduce

Run the script in dry-run mode from the repo root (read-only; it needs GH_TOKEN):

GH_TOKEN="$(gh auth token)" ci/cleanup-pr-previews --dry-run

Relevant output on current main:

[CHECK] Checking PR #2308...
[UNKNOWN] PR #2308 has unexpected status: {"message":"Not Found","documentation_url":"https://docs.github.com/rest/pulls/pulls#get-a-pull-request","status":"404"}not_found
...
Total PR preview folders: 25
Open PRs: 24
Folders to remove: 0

One of the 25 folders belongs to a PR that no longer exists, but nothing is marked for removal.

The failing call on its own:

PR_STATUS=$(gh api repos/NVIDIA/cuda-python/pulls/2308 \
    --header "Accept: application/vnd.github+json" \
    --jq '.state' 2>/dev/null || echo "not_found")
printf '[%s]\n' "$PR_STATUS"

With gh 2.97.0 this prints:

[{"message":"Not Found","documentation_url":"https://docs.github.com/rest/pulls/pulls#get-a-pull-request","status":"404"}not_found]
Expected behavior

A 404 from the pulls endpoint is classified as not_found, and the folder is removed. A fix should keep other failures (network errors, 5xx) out of the removal path, so a transient API error can't delete an open PR's preview.

#2914 also edits this script, though not these lines. I can send a small fix for the status check, before or after #2914 lands, whichever is easier to review.

Langage dominant
Cython
Étoiles
3.4k
Forks
329
Merge moyen
1 j 13 h
PR mergées (30 j)
107

Préparer son environnement

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de NVIDIA/cuda-python

Toutes les issues de NVIDIA/cuda-python

Issues similaires

Plus d'issues DevOps

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.