Repository navigation
Create a custom PR preview workflow. - #379
Open
markafoltz wants to merge 2 commits into
Open
markafoltz wants to merge 2 commits into
markafoltz wants to merge 2 commits into
Conversation
backkem
suggested changes
Oct 29, 2026
backkem
left a comment
Contributor
There was a problem hiding this comment.
Thanks, previews for all specs will help. Two concerns, and some options:
Problems
- Security: fork PRs control the uploaded artifacts (they can edit
auto-publish.ymlin their own PR), and this workflow publishes them with a write token tow3c.github.io, which every w3c repo's published specs share. The external PR Preview service avoids this by building from source itself and hosting on a separate, throwaway origin (pr-preview.s3.amazonaws.com). - Race: on merge, the cleanup job and the main spec-prod deploy push gh-pages at the same time, and spec-prod's
--force-with-leasepush can fail. A sharedconcurrency: gh-pagesgroup (push runs only in auto-publish) avoids that.
Options for point 1:
- Gate this workflow: deploy only for same-repo PRs (
workflow_run.head_repository.full_name == github.repository), or for collaborators or a maintainer label. It's the smallest change. - Host custom previews on a separate origin: an S3 bucket, Netlify, or Pages under a different org (not
w3c.github.io). It's safe for forks, at the cost of setup and a secret. - Go back to the standard service: render the CDDL preprocessing before committing, so each
.bsbuilds on its own, with a CI lint checking that the rendered output is up to date. Then PR Preview could buildnetwork.bsandapplication.bsdirectly, if.pr-preview.jsoncan list more than one spec.
I think the latter could be a safe/simple/pragmatic solution. We could add a lint to check that the CDDL preprocessing wasn't forgotten.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR replaces the generic PR preview workflow with a custom version that works with our repository. It handles multiple specifications, bundling images, and preprocessing the CDDL files to generate HTML and HTML diffs when a spec PR is pushed.
The artifacts are hosted in temporary
pr-preview/pr-<N>/folders in the gh-pages branch. The folders are removed when a PR is closed.We could move the PR preview hosting to another repository or cloud service but it's more overhead.