-
Notifications
You must be signed in to change notification settings - Fork 76
Add GitHub Actions workflows for PR preview builds and cleanup #556
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add GitHub Actions workflows for PR preview builds and cleanup #556
Conversation
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.
|
Note this doesn't work - the PR should have had an updated comment + it looks like the build didn't complete. |
|
@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 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 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. |
|
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. |
|
@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! |
|
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 ! |

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-pagesbranch 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