ci: move docs deploy into a separate workflow#372
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThis change implements a separation of concerns for documentation deployment by introducing a new GitHub Actions workflow ( Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
745b1d2 to
9791d39
Compare
There was a problem hiding this comment.
Actionable comments posted: 3
🧹 Nitpick comments (1)
.github/workflows/docs.yaml (1)
189-194: Consider upgradingpeaceiris/actions-gh-pagesto v4.While
peaceiris/actions-gh-pages@v3will still execute on GitHub Actions runners as of April 2026, the v3 line is no longer actively maintained. Upgrade topeaceiris/actions-gh-pages@v4(current major release) to use the maintained version and avoid future compatibility warnings.Suggested change
- name: Deploy to gh-pages uses: peaceiris/actions-gh-pages@v3 + uses: peaceiris/actions-gh-pages@v4🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In @.github/workflows/docs.yaml around lines 189 - 194, Update the GitHub Action step that uses the peaceiris deployment action by changing the version reference from peaceiris/actions-gh-pages@v3 to peaceiris/actions-gh-pages@v4 in the "Deploy to gh-pages" job; ensure the step name "Deploy to gh-pages" and its inputs (github_token, publish_dir, keep_files) remain unchanged and run CI to confirm there are no breaking input changes between v3 and v4.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In @.github/workflows/docs-deploy-preview.yaml:
- Around line 21-30: Add a per-PR concurrency group to the deploy-preview job so
preview deploys are serialized and older runs are cancelled when a newer run for
the same PR starts; update the deploy-preview job (job name: deploy-preview) to
include a concurrency block that sets group to a PR-specific value using the
event payload (e.g. github.event.workflow_run.pull_requests[0].number) and set
cancel-in-progress: true so stale runs cannot complete and overwrite newer
previews.
- Around line 64-70: The workflow step "Deploy PR preview to gh-pages" uses
peaceiris/actions-gh-pages@v3 which targets Node16 and will fail on modern
runners; update the `uses:` value to peaceiris/actions-gh-pages@v4 (leave other
inputs like github_token, publish_dir, destination_dir, and keep_files
unchanged) so the action runs on Node18-compatible runners.
- Around line 29-57: The workflow's permissions block is missing the actions:
read scope required for cross-run artifact downloads; update the permissions
object to include actions: read alongside contents: write so the
actions/download-artifact@v7 steps (the "Download PR metadata", "Download docs
artifact", and "Download web app artifact" steps) can access artifacts from
another run using run-id and github-token without 403 errors. Ensure the
permissions entry is added at the same level as the existing contents: write so
the three download steps succeed.
---
Nitpick comments:
In @.github/workflows/docs.yaml:
- Around line 189-194: Update the GitHub Action step that uses the peaceiris
deployment action by changing the version reference from
peaceiris/actions-gh-pages@v3 to peaceiris/actions-gh-pages@v4 in the "Deploy to
gh-pages" job; ensure the step name "Deploy to gh-pages" and its inputs
(github_token, publish_dir, keep_files) remain unchanged and run CI to confirm
there are no breaking input changes between v3 and v4.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 8d4b0e88-0325-4f0e-b5de-9c5798319c10
📒 Files selected for processing (2)
.github/workflows/docs-deploy-preview.yaml.github/workflows/docs.yaml
9791d39 to
f71313b
Compare
Docs PR Preview Deploy — How It Works
The fork PR problem
When a PR comes from a fork, GitHub runs the
pull_request-triggered workflow in the fork's context. TheGITHUB_TOKENit gets is scoped to the fork — it can read the base repo but cannot write to it. That's whygit push origin gh-pagesonNVIDIA/IsaacTeleopreturns 403.Why
workflow_runfixes itworkflow_runis special: it always runs in the base repo's context, even when the triggering workflow ran on a fork PR. So:pull_requesttriggerworkflow_runtriggerNVIDIA/IsaacTeleop)GITHUB_TOKENcan write to base?By splitting build (safe, no write needed) from deploy (needs write), the deploy runs with base-repo permissions.
Why the two-artifact handoff?
Since this is a separate workflow run, it doesn't share the workspace of the build workflow. The three
download-artifactsteps userun-idto reach back and grab artifacts from the triggering build run. That's also whyactions: readpermission is needed — downloading artifacts cross-run requires it.Why the PR number is passed via artifact
In a
workflow_runcontext,github.event.pull_requestdoesn't exist — the event payload is about the workflow run, not the PR. So the build workflow saves the PR number to a file, and this workflow reads it back to construct thepreview/pr-<N>/destination path.The
environment: docs-previewgateThis is the manual approval layer. Without it, the deploy would run automatically for every fork PR — which means untrusted code could generate arbitrary HTML and push it to your GitHub Pages. The environment's required reviewers ensure someone with write access eyeballs the build before it goes live.
Setup
Create a
docs-previewenvironment in repo Settings → Environments, then add required reviewers (anyone with write access to the repo).Does this block PR merging?
No.
workflow_runis completely decoupled from the PR's status checks. It runs as a separate workflow associated with the default branch, not the PR's head commit.Only workflows triggered directly by
pull_request/pushevents can appear as status checks on a PR, and only those added to branch protection's "required status checks" can block merging. Theworkflow_runworkflow won't show up there at all.The preview deploy is entirely opt-in / best-effort — it never gates merging.
Flow summary