ci: skip docs preview deploy for fork PRs - #2029
Conversation
Signed-off-by: h-guo18 <67671475+h-guo18@users.noreply.github.com>
|
Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually. Contributors can view more details about this message here. |
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe preview deployment workflow now skips fork-originated pull requests by requiring the pull request source repository to match the current repository, avoiding blocked preview pushes. ChangesPreview deployment workflow
Estimated code review effort: 1 (Trivial) | ~5 minutes Suggested reviewers: ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2029 +/- ##
=======================================
Coverage 66.83% 66.83%
=======================================
Files 519 519
Lines 58916 58916
=======================================
Hits 39376 39376
Misses 19540 19540
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
What does this PR do?
Type of change: Bug fix (CI)
The
deploy-previewjob in theDocsworkflow fails on every pull request opened from a fork, which blocks merging for all external contributors.Root cause.
deploy-previewrunsrossjrw/pr-preview-action@v1, which pushes the built HTML to thegh-pagesbranch. The workflow declarespermissions: contents: write, but for apull_requestevent originating from a forked repository GitHub caps theGITHUB_TOKENat read-only — thepermissions:block cannot elevate above that cap. The push is therefore rejected:The job's
if:condition gated ongithub.event_name,github.event.actionand thechangespath filter, but never on whether the PR came from a fork — so it always ran and always failed.Because the
changesfilter matchesdocs/**,modelopt/**and.github/workflows/pages.yml, essentially any substantive fork PR trips this.Fix. Restrict
deploy-previewto PRs whose head branch lives in this repository:github.event.pull_request.head.repo.full_name == github.repositoryA skipped job is not a failed job, so fork PRs are no longer blocked by it.
Usage
N/A — CI-only change.
Testing
Behaviour by scenario:
head.repoisnull)Docsruns on in-repo branches (main,chenjiel/nvfp4-act-headroom,mxin/qad-skill,haoguo/dspark-ptq-script) all succeed, while fork-branch runs fail with the 403 above.build-docswas already passing on the affected PRs — only the deploy step failed, so documentation builds are unaffected either way.pre-commit run --files .github/workflows/pages.ymlpasses. (yamlfmtexcludes^.github/workflows/, so this file is not auto-formatted.).github/workflows/pages.yml, which is itself in thechangesfilter, so it exercisesdeploy-previewon the in-repo path — the preview deploy on this PR passing is a self-check that the unchanged path still works.The
closedcleanup path is gated by the same condition. That is intentional: a fork PR never deployed a preview directory, so there is nothing to remove.Before your PR is "Ready for review"
CONTRIBUTING.md: N/AAdditional Information
Currently blocking #1975 (
add Qwen3-VL support for DFlash training), which is approved with every other check green and sits atmergeStateStatus: BLOCKEDsolely because of this job.Note that a PR only picks up this fix once its branch contains it, since workflows run from the PR branch's own definitions.
A follow-up option, if doc previews for external contributors are wanted: build in the
pull_requestworkflow and deploy from a separateworkflow_run-triggered workflow, which executes in the base-repo context and does get a write token. Deliberately not usingpull_request_targethere — that would run unreviewed PR code with write permissions.Summary by CodeRabbit