ci: publish PR 一打开就把 .deb 自动镜像进 staging(去 fork 依赖,纯 Actions)#71
Merged
Conversation
Add capture-to-staging.yml (pull_request_target): whenever a publish PR opens or updates a pool/main/**/*.deb.release.json manifest, download the referenced .deb, verify it against the manifest sha256 and mirror it into the org-controlled 'staging' release. Pending binaries therefore stop depending on the contributor's fork staying alive. The PR's code is never checked out or executed; manifests are read via the API and treated as data, with strict filename/url validation. Teach the promote step in update-index.yml to fetch from the staging mirror first and only fall back to the manifest url, so promotion works even if the fork or its buffer release has been deleted.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
目的
czdev 提交的 .deb 目前存在贡献者自己 fork 的
czdev-bufferrelease 里——fork 一删包就没了。本 PR 用纯 GitHub Actions(不依赖任何 Cloudflare/动态服务器)把这一风险闭环。内容
1. 新增
capture-to-staging.yml(自动捕获)pull_request_target,当 PR 改动pool/main/**/*.deb.release.json时(opened / synchronize)。filename(Debian 包名模式、不含路径)与url(必须在 github.com)→ 下载 .deb → sha256 必须与清单一致 → 镜像上传到本仓库的stagingrelease(已存在同名同内容则跳过)。pull_request_target带写权限,已刻意收紧攻击面):validate-pr.yml负责,promote 时还会再验一次 sha256。2.
update-index.ymlpromote 加回退提升进 apt-pool 时优先从 staging 镜像取,staging 没有或 sha 不匹配才回退到清单 url(fork)。配合捕获后,即使贡献者删了 fork,已开过 PR 的包也能照常上架。
效果
czdev 无需任何改动,开发者无感知。
验证
bash -n通过。