Skip to content

add Cloudflare Pages deploy previews for fork PRs ( updated title)#632

Open
Ashutoshx7 wants to merge 5 commits intokgateway-dev:mainfrom
Ashutoshx7:pr-preview-support
Open

add Cloudflare Pages deploy previews for fork PRs ( updated title)#632
Ashutoshx7 wants to merge 5 commits intokgateway-dev:mainfrom
Ashutoshx7:pr-preview-support

Conversation

@Ashutoshx7
Copy link
Copy Markdown
Contributor

@Ashutoshx7 Ashutoshx7 commented Jan 28, 2026

Description (Updated)

This PR adds automatic documentation previews for Pull Requests using Cloudflare Pages, with a specific focus on supporting contributions from forks.

Motivation:
Currently, Cloudflare previews only work for branches pushed directly to the main repository. This PR implements a "workflow_run" pattern to enable previews for all contributors (including those working from forks) while maintaining repository security.

What changed:

  • Two-Stage Deployment Workflow:
    • build-pr.yml: Builds the site on pull_request and uploads the artifact. It has no access to secrets and is safe for forks.
    • deploy-preview.yml: Triggers only after the build finishes. It runs in the privileged context of the main repo, allowing it to securely access Cloudflare credentials and deploy the preview.
  • Platform Consistency: Sticks to the project's existing Cloudflare stack instead of moving to Netlify.
  • DCO Compliance: All commits are properly signed-off.

Related issues:
Fixes #593

Change Type

/kind feature
/kind install

Changelog

Added secure Cloudflare Pages PR previews that support contributions from forks.

Additional Notes

This workflow will officially start triggering once it is merged into the default branch. To enable the automated deployments, the following secrets should be configured in the repository:

CLOUDFLARE_API_TOKEN
CLOUDFLARE_ACCOUNT_ID
CLOUDFLARE_PROJECT_NAME

This PR adds a new GitHub Actions workflow to automatically build and deploy PR previews to Netlify.

Features:
- Builds Hugo site with Go 1.21, Node 20, and Hugo 0.135.0 (Extended)
- Deploys preview to Netlify
- Posts the preview URL as a comment on the PR
- Caches Go and npm dependencies for faster builds
- Cancels obsolete in-progress builds for the same PR

Fixes kgateway-dev#593

Signed-off-by: Ashutosh Singh <karns7844@gmail.com>
@artberger
Copy link
Copy Markdown
Contributor

Hi @Ashutoshx7 thanks for looking into this. Currently, we use Cloudflare, not Netlify, for this kgateway.dev site. And we technically have this feature already with Cloudflare previews on PRs. The catch is, those only work on PRs that are branches of this repo. If the PR comes from a fork, which is the typical flow for our contributions, it does not work. Do you know if this Netlify approach of yours has a similar limitation?

- Implemented workflow_run pattern to securely handle fork PRs
- Switched from Netlify to Cloudflare Pages as preferred by maintainers
- Split build and deploy stages for better security and reliability

Signed-off-by: Ashutosh Singh <karns7844@gmail.com>
@Ashutoshx7 Ashutoshx7 changed the title feat(ci): add Netlify deploy preview workflow add Cloudflare Pages deploy previews for fork PRs Jan 30, 2026
@Ashutoshx7 Ashutoshx7 changed the title add Cloudflare Pages deploy previews for fork PRs add Cloudflare Pages deploy previews for fork PRs ( updated title) Jan 30, 2026
@Ashutoshx7
Copy link
Copy Markdown
Contributor Author

Ashutoshx7 commented Jan 30, 2026

Hi @Ashutoshx7 thanks for looking into this. Currently, we use Cloudflare, not Netlify, for this kgateway.dev site. And we technically have this feature already with Cloudflare previews on PRs. The catch is, those only work on PRs that are branches of this repo. If the PR comes from a fork, which is the typical flow for our contributions, it does not work. Do you know if this Netlify approach of yours has a similar limitation?

switched from Netlify to Cloudflare so it matches current stack.

@Ashutoshx7
Copy link
Copy Markdown
Contributor Author

@artberger
The workflow is set up to support preview deployments for fork PRs using a secure token before it runs, so it should solve the limitation you mentioned.

Upgraded all solo.io laboratory links from insecure HTTP to secure HTTPS protocol. This enhances security by encrypting data in transit and improves SEO as modern search engines prefer HTTPS links.

Changes:

- data/labs.yaml: Updated 7 lab URLs to use HTTPS

- layouts/shortcodes/learning-paths-list.html: Updated template to use HTTPS

- content/blog/guide-to-installing-kgateway.md: Updated blog link to use HTTPS

Signed-off-by: Ashutosh Singh <karns7844@gmail.com>
Signed-off-by: Ashutosh Singh <karns7844@gmail.com>
This reverts commit e4964af.

Signed-off-by: Ashutosh Singh <karns7844@gmail.com>
@Ashutoshx7
Copy link
Copy Markdown
Contributor Author

Ashutoshx7 commented Feb 4, 2026

in a recent commit i just improved deploy workflow error handling and PR comments

@Ashutoshx7
Copy link
Copy Markdown
Contributor Author

@artberger incase you missed this !
i am intrested in solving this issue
Lmk your thoughts

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.

Support PR Preview

2 participants