尝试将 PR 预览构建由手动改为自动触发
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 30
- Forks
- 23
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 4
Description
近期在研究如何将 HMCL Checkstyle 报告以 PR Review Comment 的形式呈现,期间引发了我对现有 PR 预览机制的思考。
现在 PR 预览构建是需要仓库管理员通过命令 / 打标签的方式手动触发。我想是否可以直接在 PR 创建及修改时自动构建产物并部署到 Github Pages 上以供预览。
基本思路是:将构建和部署拆分为两个独立工作流。首先,通过 pull_request 事件触发构建流程,在不暴露仓库密钥的安全环境下完成编译,并将产物上传至 Artifacts。随后,利用 workflow_run 在构建成功时触发第二步,将产物部署到 GitHub Pages 用于预览。
当然,这也可能导致安全隐患:恶意 PR 可以通过篡改文档内容或工作流配置,来构建违规的预览产物(例如植入广告或营销信息)。不过,由于该产物仅用于临时预览,且内容托管在 GitHub Pages 上,个人认为安全风险整体可控。
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the repository’s existing manual PR preview trigger and workflow configuration. Define how pull_request builds upload artifacts without exposing secrets, then how workflow_run deploys successful artifacts to GitHub Pages; done means PR creation and updates trigger preview builds automatically while failed builds do not deploy.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github, github-actions
- Domain
- ci-cd, devops
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100