Skip to content

ci: deploy netlify previews for stacked docs prs - #2851

Merged
Piotr1215 merged 6 commits into
mainfrom
devops-1556/stacked-pr-previews
Sep 28, 2026
Merged

Piotr1215 merged 6 commits into
mainfrom
devops-1556/stacked-pr-previews

Conversation

@Piotr1215

@Piotr1215 Piotr1215 commented Sep 28, 2026 •

Copy link
Copy Markdown
Contributor

Content Description

Stacked docs PRs get no Netlify Deploy Preview, because Netlify only builds previews for PRs against branches it deploys. This adds a workflow that builds those PRs and deploys a Netlify draft at pr-<number>, then posts the URL as a sticky PR comment that updates on every push.

Key Changes

Production and next deploys are unchanged: no Netlify setting or netlify.toml change, and draft deploys only.

sticky-pr-comment is referenced by its action tag, following the loft-sh convention for internal actions. zizmor flags it as unpinned-uses, which is expected. Other workflows here pin internal actions by SHA; say if you want this one to match.

Dependencies

None. The workflow reuses the existing org secret NETLIFY_ACCESS_TOKEN, which is proven to deploy vcluster-docs-site drafts. The site ID is in the workflow, since it grants no access.

TODO

Preview Link

No rendered pages change. CONTRIBUTING.md and the workflows README aren't part of the site, so review the diff.

Internal Reference

Closes DEVOPS-1556

AI review: mention @claude in a comment to request a review or changes. See CONTRIBUTING.md for available commands.

FORK LIMITATION: @claude does not work on pull requests opened from forks. GitHub Actions cannot access the required secrets for fork-originated PRs. To use AI review, push your branch directly to this repository.

@netlify /docs

Netlify builds Deploy Previews only for PRs against branches it deploys
(main, next, the archived vcluster-v* and platform-v* branches). Stacked
PRs such as #2846 got no preview, so reviewers could not see rendered
pages until the base merged, unless someone with Netlify access ran the
manual CLI deploy from bc38bfd after every push.

The new workflow builds any other same-repo PR with netlify build, so it
uses netlify.toml's command and environment, uploads a draft at the
alias pr-<number>, and upserts the URL through sticky-pr-comment. It
never passes --prod. The deploy script rejects anything but a positive
integer PR number, so the alias cannot take a deployed branch's
subdomain. A missing NETLIFY_AUTH_TOKEN fails the job rather than
passing green with nothing deployed.

Closes DEVOPS-1556
@Piotr1215
Piotr1215 requested a review from a team as a code owner September 28, 2026 08:20
@netlify

netlify Bot commented Sep 28, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for vcluster-docs-site ready!

Name Link
🔨 Latest commit a34203c
🔍 Latest deploy log https://app.netlify.com/projects/vcluster-docs-site/deploys/6aba28b03b51d500086942aa
😎 Deploy Preview https://deploy-preview-2851--vcluster-docs-site.netlify.app/docs
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

@github-actions

Copy link
Copy Markdown
Contributor

Job-level env exposed NETLIFY_AUTH_TOKEN to npm ci, so any dependency's install script could read it. Only the token check, netlify build and the deploy step need it.
The first stacked preview run (#2852) failed at deploy: netlify-cli 27 errors with '--context flag is only available when using the --build flag'. The bats stub accepted any flags, so the suite missed it. The build step already applies the deploy-preview context.
No repo secret NETLIFY_AUTH_TOKEN exists. The org secret NETLIFY_ACCESS_TOKEN deployed a working draft on #2852 (run 36397634809), so reuse it instead of minting and rotating a new credential. The CLI still reads it as NETLIFY_AUTH_TOKEN.
Native GitHub stacks based on main, such as #2819 and #2820, already
get Netlify Deploy Previews: the API reports their stack.base.ref as
main. Branch-on-branch stacks like #2846 have no stack field and get
none. branches-ignore only sees the immediate base, so the workflow
would have built a duplicate preview for native stacks. A check job
now reads stack.base.ref and skips them.

The comment now uses the table layout of Netlify's own preview comment
and links the deploy log, so both previews read the same way.
@Piotr1215
Piotr1215 merged commit 56faa53 into main Sep 28, 2026
10 checks passed
@Piotr1215
Piotr1215 deleted the devops-1556/stacked-pr-previews branch September 28, 2026 08:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant