Skip to content

Conversation

@bburt-rh
Copy link
Collaborator

@bburt-rh bburt-rh commented Nov 20, 2025

Add two workflows to automatically build and deploy HTML previews for pull requests:

  • pr-preview.yml: Builds AsciiDoc to HTML and deploys previews to GitHub Pages subdirectories (pr-{number}/) without interfering with the main production site. Supports fork PRs using pull_request_target and comments on PRs with preview links.

  • pr-preview-cleanup.yml: Automatically removes PR preview directories from gh-pages branch when PRs are closed or merged.

Each PR gets a unique preview URL at {owner}.github.io/{repo}/pr-{number}/main.html that updates automatically on new commits.

Issue:

Additional information:
By enabling writers and reviewers to view live HTML previews of all changes made in a PR, these workflows will help streamline the PR review process and should result in reduced time-to-review and time-to-merge for all submitted SSG PRs

Add two workflows to automatically build and deploy HTML previews for pull requests:

- pr-preview.yml: Builds AsciiDoc to HTML and deploys previews to GitHub Pages
  subdirectories (pr-{number}/) without interfering with the main production site.
  Supports fork PRs using pull_request_target and comments on PRs with preview links.

- pr-preview-cleanup.yml: Automatically removes PR preview directories from
  gh-pages when PRs are closed or merged.

Each PR gets a unique preview URL at {owner}.github.io/{repo}/pr-{number}/main.html
that updates automatically on new commits.
@IngridT1 IngridT1 merged commit 1783ee8 into redhat-documentation:main Nov 20, 2025
1 check passed
@aireilly
Copy link
Member

Note this doesn't work - the PR should have had an updated comment + it looks like the build didn't complete.

@bburt-rh
Copy link
Collaborator Author

@aireilly Which PR should've had a preview? This one could not have a preview because this is the PR that adds the preview functionality and so couldn't build a preview for itself because the functionality didn't exist until it was merged.

The preview built for the updated commit to #555, and then the preview was deleted when the PR merged.

You can also submit a PR with a minor change to see the feature in action, and then close it to confirm that the preview files are deleted from GH Pages. Lmk if you see any unexpected behavior.

@aireilly
Copy link
Member

aireilly commented Nov 25, 2025

expected a preview here: #549

But - I think the PR didn't get a preview because it wasn't up to date.

I don't see a preview here.

edit:
image

PR workflow needs something fixed 🤷

@bburt-rh
Copy link
Collaborator Author

bburt-rh commented Nov 25, 2025

@aireilly The preview can take a couple of minutes to build. The comment can get added before the build is done. Try the link again, it works for me now.

Maybe we need to add some logic to only add the comment after the build is done?

@IngridT1
Copy link
Collaborator

IngridT1 commented Nov 25, 2025

@bburt-rh Jocelyn made a change to PR #555, so there should have been a preview. In fact, there was a link for the preview. But when I tried to view it, I got the 404 message that @aireilly posted.

I then viewed the PR locally on my machine, and it looked fine so I merged it.

@bburt-rh
Copy link
Collaborator Author

@IngridT1 the preview link is getting added before the build completes. If you wait a few minutes, the link works. When I'm back from the holiday, I'll fix it so that the comment with the link only gets added after the preview is built and deployed.

@bburt-rh
Copy link
Collaborator Author

bburt-rh commented Nov 25, 2025

And the link won't work for merged or closed PRs because the deployment is deleted after merging or closing a PR. I'll add some wording to the comment that says this just so that people know why the link no longer works.

@IngridT1
Copy link
Collaborator

@bburt-rh I did actually try the preview link multiple times, so it wasn't an issue of not waiting long enough. After I viewed Jocelyn's PR locally and saw that it was fine, I figured I'd go ahead and merge it.

I did realize that the link doesn't work for merged or closed PRs, because you did such a good job of walking me through all that earlier :-) After I merged it, I realized that you might have wanted to see the behavior when you got back. But, alas, it's too late now. Enjoy your break!

@bburt-rh
Copy link
Collaborator Author

bburt-rh commented Nov 25, 2025

Thanks! I'll add logic so that the comment and link only get added only after the deployed build actually is verified to exist.

Have a wonderful Thanksgiving, @IngridT1 !

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.

3 participants