Skip to content

Fix PR preview base URLs for forks and add link/asset CI tests - #63

Merged
nschimme merged 3 commits into
MUME:masterfrom
nschimme:fix-pr-fork-preview-base-urls-16288324530633516842
Sep 20, 2026
Merged

nschimme merged 3 commits into
MUME:masterfrom
nschimme:fix-pr-fork-preview-base-urls-16288324530633516842

Conversation

@nschimme

@nschimme nschimme commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary by Sourcery

Ensure fork previews use correct base URLs and validate generated links and assets across deployment environments.

Bug Fixes:

  • Correct base URL detection for GitHub Pages repositories across fork and owner-name casing differences.
  • Preserve explicitly configured deployment base paths instead of overriding them in production environments.

Enhancements:

  • Add automated validation of generated internal links, asset references, and site base metadata.

Build:

  • Run generated link and asset path validation as part of Docker image builds.

CI:

  • Run link and asset path checks in deployment and pull-request preview workflows.

Documentation:

  • Fix the Web News link to use a relative path compatible with preview deployments.

Tests:

  • Introduce tests that verify generated links and assets resolve correctly for their configured deployment base.

Fix PR preview base path determination for forks targeting mume.github.io so builds use VITE_BASE=/pr-N/ on docs.mume.org. Add an automated link and asset path verification test script (npm test) integrated into CI workflows and Dockerfile to prevent path regression or broken asset references.
Fix PR preview base path determination for forks targeting mume.github.io so builds use VITE_BASE=/pr-N/ on docs.mume.org and /repo/pr-N/ on subdirectory forks. Add an automated link and asset path verification test script (npm test) integrated into CI workflows and Dockerfile to prevent path regression or broken asset references.
@sourcery-ai

sourcery-ai Bot commented Sep 20, 2026 •

Copy link
Copy Markdown
Contributor

Reviewer's Guide

The PR fixes deployment-prefix handling for forks and case variations, preserves explicit VITE_BASE settings, and introduces a generated-output test that validates internal links, asset references, and VitePress base metadata across deployment and container build paths.

Flow diagram for deployment base URL validation

flowchart TD
    A["Determine repository and owner"] --> B["Normalize names to lowercase"]
    B --> C{"Official user site?"}
    C -->|yes| D["Use / prefix"]
    C -->|no| E["Use /repository/ prefix"]
    D --> F["Append pr-number prefix for PR previews"]
    E --> F
    F --> G["Build generated site with VITE_BASE"]
    G --> H["npm test validates links, assets, and base metadata"]
Loading

File-Level Changes

Change Details Files
Make PR preview and production base-path detection robust for forked repositories and preserve explicitly configured bases.
  • Normalize repository and owner names before identifying user-site repositories.
  • Only apply the official production root fallback when VITE_BASE is unset.
  • Use the computed base prefix consistently during preview builds and validation.
.github/workflows/pr-preview.yml
scripts/ci-env.sh
Add automated validation that built HTML references resolve correctly under the configured deployment prefix.
  • Scan generated HTML for internal links, assets, and VitePress site-data base values.
  • Resolve referenced files against dist/ and reject stale hardcoded mume.github.io prefixes.
  • Run validation in PR previews, deployment builds, and the Docker image build.
scripts/test-link-and-asset-paths.js
package.json
.github/workflows/deploy.yml
.github/workflows/pr-preview.yml
Dockerfile
Correct a documentation link to work relative to the deployed page base.
  • Change the Web News link from an absolute root path to a relative path.
docs/news/index.md

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Fix PR preview base path determination for forks targeting mume.github.io so builds use VITE_BASE=/pr-N/ on docs.mume.org and /repo/pr-N/ on subdirectory forks. Add an automated link and asset path verification test script (npm test) integrated into CI workflows and Dockerfile to prevent path regression or broken asset references.

@sourcery-ai sourcery-ai 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.

Sourcery assessment

Approved.

@sourcery-ai sourcery-ai 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.

Hey - I've reviewed your changes and they look great!

Sourcery assessment

Needs a human reviewer. If the base-path logic or new checks are wrong, the deployment can produce a site with broken links/assets or block an otherwise valid deployment. Reverting the change stops future failures, and an affected deployment can be repaired by rebuilding and redeploying.


Sourcery is free for open source - if you like our reviews please consider sharing them ✨

@nschimme
nschimme merged commit 8b30f13 into MUME:master Sep 20, 2026
4 checks passed

This branch was successfully deployed

1 active deployment
pr-63 — fa6ea83a Deployed Sep 20, 2026 by github-actions[bot]
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.

1 participant