[BUG]: cleanup-pr-previews never removes previews of deleted PRs
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 84/100
调研方向
从第 137-139 行附近的 ci/cleanup-pr-previews 开始,并从 repository 根目录运行文档中记录的 dry-run 命令。复现 PR #2308 的 404 行为,然后验证状态处理能够区分已删除的 PR 与其他 API 故障,并且只删除相应的 preview 文件夹。
由索引模型根据 Issue 内容生成。
描述
Is this a duplicate?
- I confirmed there appear to be no duplicate issues for this bug and that I agree to the Code of Conduct
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:
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.
- 主要语言
- Cython
- 星标
- 3.4k
- 派生
- 329
- 平均合并
- 1 天 15 小时
- 30 天内合并 PR
- 112
环境准备
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
NVIDIA/cuda-python 的其他 Issue
-
bug cuda.core
难度 2/5 1-3 小时 新手友好度 76/100
NVIDIA/cuda-python#2886 · 1 条评论 ·
维护者通常 1 天内回复
-
[DOC]: cuda.core 1.1.1 note misstates program cache permissions可能已有人在做 @leofang 于 3 天前认领。 未关闭documentation P1
难度 1/5 1 小时以内 新手友好度 88/100
NVIDIA/cuda-python#2717 · 已指派 1 人 ·
维护者通常 1 天内回复
-
[DOC]: `PinnedMemoryResource.allocate` documents no parameters可能已有人在做 @Andy-Jost 于 3 天前认领。 未关闭cuda.core documentation P1
难度 1/5 1-3 小时 新手友好度 90/100
NVIDIA/cuda-python#2712 · 已指派 1 人 ·
维护者通常 1 天内回复
-
triage
难度 2/5 1-3 小时 新手友好度 82/100
NVIDIA/cuda-python#2646 · 1 个 reaction ·
维护者通常 1 天内回复
-
[FEA]: Support inheritance from Buffer可能已有人在做 @leofang 于 3 天前认领。 未关闭cuda.core triage
难度 2/5 1-3 小时 新手友好度 62/100
NVIDIA/cuda-python#2435 · 1 条评论 ·
维护者通常 1 天内回复
查看 NVIDIA/cuda-python 的全部 Issue
相似的 Issue
-
难度 1/5 1 小时以内 新手友好度 88/100
维护者通常 1 天内回复
-
area/cli kind/bug
难度 2/5 1-3 小时 新手友好度 90/100
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 68/100
alunduil/zfs-replicate#730 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 72/100
-
infrastructure
难度 1/5 1-3 小时 新手友好度 65/100
alunduil/siren-json.hs#232 ·
维护者通常 1 天内回复