Skip to content

Update Previews - #392

Open
anarnold97 wants to merge 2 commits into
migtools:mainfrom
anarnold97:New-Preview-PR
Open

Update Previews#392
anarnold97 wants to merge 2 commits into
migtools:mainfrom
anarnold97:New-Preview-PR

Conversation

@anarnold97

@anarnold97 anarnold97 commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added automatic documentation preview sites for eligible pull requests.
    • Preview links are posted in pull request comments and updated when new changes are pushed.
    • Preview builds include the relevant commit reference for easier verification.
  • Bug Fixes

    • Automatically removes documentation previews when their associated pull requests are closed.
    • Updates preview comments to indicate when a preview is no longer available.

To Do

Two one-time settings steps in GitHub:

  1. Actions permissions: SettingsActionsGeneralWorkflow permissions → select "Read and write permissions" → check "Allow GitHub Actions to create and approve pull requests" → Save
  2. Enable GitHub Pages: SettingsPagesSource → "Deploy from a branch" → Branch: gh-pages, folder: / (root) → Save

The gh-pages branch won't exist yet — the first PR preview run creates it automatically. Come back and do step 2 after that first run completes.

Once both are done, open any PR that touches a file in docs/, assemblies/, or topics/ and we should see the preview workflow trigger and a bot comment appear with the link.


Summary by CodeRabbit

  • New Features

    • Documentation changes in pull requests now generate an accessible preview site.
    • Preview links, commit details, and update timestamps are posted or refreshed automatically.
    • Preview sites are updated when new changes are pushed or a pull request is reopened.
  • Bug Fixes

    • Closed pull request previews are automatically removed.
    • Preview status comments are updated to indicate when a preview has been removed.

Signed-off-by: A.Arnold <anarnold@redhat.com>
@anarnold97
anarnold97 requested a review from vashirova July 24, 2026 20:35
@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 63993bd6-99d0-4469-8b70-1ac66a44dad0

📥 Commits

Reviewing files that changed from the base of the PR and between df5b0c9 and de02140.

📒 Files selected for processing (2)
  • .github/workflows/pr-preview-cleanup.yml
  • .github/workflows/pr-preview.yml
🚧 Files skipped from review as they are similar to previous changes (2)
  • .github/workflows/pr-preview-cleanup.yml
  • .github/workflows/pr-preview.yml

📝 Walkthrough

Walkthrough

Adds GitHub Actions workflows that build and publish pull request documentation previews, maintain preview status comments, and remove preview directories and update comments when pull requests close.

Changes

Pull request preview lifecycle

Layer / File(s) Summary
Preview build workflow
.github/workflows/pr-preview.yml
Triggers on selected pull request changes, configures Ruby and Asciidoctor, and builds the Jekyll site under a pull-request-specific base URL.
Preview deployment
.github/workflows/pr-preview.yml
Publishes generated files to gh-pages/pr-previews/<PR_NUMBER> and pushes only when content changes.
Preview status comment
.github/workflows/pr-preview.yml
Creates or updates the marked pull request comment with the preview URL, short commit SHA, and timestamp.
Closed pull request cleanup
.github/workflows/pr-preview-cleanup.yml
Removes the corresponding preview directory from gh-pages and updates the existing preview comment.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant PullRequest
  participant GitHubActions
  participant Jekyll
  participant GhPages
  participant PreviewComment
  PullRequest->>GitHubActions: Trigger preview workflow
  GitHubActions->>Jekyll: Build site with PR base URL
  Jekyll-->>GitHubActions: Generate _site
  GitHubActions->>GhPages: Publish pr-previews/<PR_NUMBER>
  GitHubActions->>PreviewComment: Create or update preview comment
  PullRequest->>GitHubActions: Trigger cleanup on close
  GitHubActions->>GhPages: Remove pr-previews/<PR_NUMBER>
  GitHubActions->>PreviewComment: Mark preview as removed
Loading

Suggested reviewers: vashirova

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Title check ❓ Inconclusive The title is related to preview-site work, but it's too generic to clearly state the main change. Rename it to mention automatic PR preview workflows or preview cleanup so the main change is obvious.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (1)
.github/workflows/pr-preview.yml (1)

42-43: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Missing apt-get update before install.

sudo apt-get install -y asciidoctor runs without a preceding apt-get update, which can occasionally fail with stale/missing package indexes on the runner image. Also note the Gemfile already includes the asciidoctor Ruby gem, so this system package may be redundant for jekyll-asciidoc.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/pr-preview.yml around lines 42 - 43, Update the “Install
system dependencies” workflow step to run apt-get update before installing
asciidoctor, or remove the system package installation if the existing Gemfile
dependency fully provides the required functionality. Keep the preview
workflow’s dependency setup correct and avoid retaining a redundant
installation.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/pr-preview.yml:
- Around line 126-130: Update the comment lookups in
.github/workflows/pr-preview.yml lines 126-130 and
.github/workflows/pr-preview-cleanup.yml lines 52-56 to use github.paginate with
github.rest.issues.listComments and the existing owner, repo, and issue_number
parameters before searching for the marker, so both workflows inspect all
comment pages.
- Around line 54-93: Serialize all shared gh-pages deployments by adding the
same job/workflow-level concurrency group, gh-pages-deploy, to
.github/workflows/pr-preview.yml lines 54-93 and
.github/workflows/pr-preview-cleanup.yml lines 24-37. In both workflows, update
the git push logic to fetch the current gh-pages branch, rebase the local
commit, and retry on non-fast-forward failure before failing; apply the
equivalent change in each site so build and cleanup pushes self-heal
consistently.
- Around line 3-22: Update .github/workflows/pr-preview.yml lines 3-22 and
.github/workflows/pr-preview-cleanup.yml lines 3-9 to explicitly handle fork
pull requests: either restrict preview deployment and cleanup to same-repository
branches, or split fork handling into an untrusted artifact-producing job and a
trusted job that performs gh-pages pushes and PR comment operations with
elevated permissions.
- Around line 30-34: Make credential persistence explicit in the checkout steps:
add persist-credentials: true to the checkout action in
.github/workflows/pr-preview.yml lines 30-34 and
.github/workflows/pr-preview-cleanup.yml lines 17-22, preserving the later git
push authentication; no other changes are required.

---

Nitpick comments:
In @.github/workflows/pr-preview.yml:
- Around line 42-43: Update the “Install system dependencies” workflow step to
run apt-get update before installing asciidoctor, or remove the system package
installation if the existing Gemfile dependency fully provides the required
functionality. Keep the preview workflow’s dependency setup correct and avoid
retaining a redundant installation.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d15c4e59-c914-4c6f-b849-5883314bc4be

📥 Commits

Reviewing files that changed from the base of the PR and between 4ad34f6 and df5b0c9.

📒 Files selected for processing (2)
  • .github/workflows/pr-preview-cleanup.yml
  • .github/workflows/pr-preview.yml

Comment thread .github/workflows/pr-preview.yml
Comment thread .github/workflows/pr-preview.yml
Comment thread .github/workflows/pr-preview.yml
Comment thread .github/workflows/pr-preview.yml Outdated
Signed-off-by: A.Arnold <anarnold@redhat.com>

@vashirova vashirova left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@anarnold97 LGTM, thank you.

@rheslop

rheslop commented Jul 28, 2026

Copy link
Copy Markdown

LGTM

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