Fix fork deployment links#10
Merged
nschimme merged 2 commits intoMUME:masterfrom May 5, 2026
Merged
Conversation
Modified GitHub workflows and environment scripts to conditionally use the root CNAME file only when the repository owner is 'mume'. This ensures that forked repositories correctly generate deployment links pointing to their own GitHub Pages domain (<username>.github.io/<repo>) rather than the official MUME domain. Specifically: - Updated .github/workflows/pr-preview.yml to use owner-aware host detection. - Updated .github/workflows/deploy.yml to conditionally copy CNAME and set deployment URLs. - Updated scripts/ci-env.sh to dynamically resolve VITE_HOSTNAME based on repo ownership.
…ndant PR comments This commit ensures that forked repositories correctly use their GitHub Pages URL (<username>.github.io/<repo>) for deployments and PR previews, rather than the official MUME domain. Key changes: - Updated `.github/workflows/pr-preview.yml` and `.github/workflows/deploy.yml` to only use the `CNAME` file and the `docs.mume.org` domain if the repository owner is 'mume'. - Aligned URL construction logic across workflows and `scripts/ci-env.sh` for consistency. - Removed the redundant "Build ready" bot comment from PRs in favor of the native GitHub deployment status button. - Improved environment variable defaulting in `scripts/ci-env.sh` for better robustness.
Contributor
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts preview and deploy URL handling to work correctly for the main repo, forks, and GitHub Pages repos, and removes the PR build-status comment step. Flow diagram for preview base URL determination in PR workflowsflowchart TD
subgraph PR_Preview_Workflow
A1[Start Determine Base URL Prefix] --> B1{CNAME exists AND repository_owner = mume}
B1 -->|yes| C1[Set prefix = / and host = CNAME]
B1 -->|no| D1{repository.name = repository_owner.github.io}
D1 -->|yes| E1[Set prefix = / and host = repository.name]
D1 -->|no| F1[Set prefix = /repository.name/ and host = repository_owner.github.io]
end
subgraph Deploy_Workflow
A2[After build] --> B2{CNAME exists AND repository_owner = mume}
B2 -->|yes| C2[Copy CNAME into dist/CNAME]
B2 -->|no| D2[Do not copy CNAME]
E2[Set default base = https://owner.github.io] --> F2{CNAME exists AND owner = mume}
F2 -->|yes| G2[Read domain from CNAME and set base = https://domain]
F2 -->|no| H2[Set repo = context.repo.repo]
H2 --> I2{repo != owner.github.io}
I2 -->|yes| J2[Set base = base + /repo]
I2 -->|no| K2[Keep base unchanged]
G2 --> L2[Construct preview URL = base + /pr-PR_NUMBER/]
J2 --> L2
K2 --> L2
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Build readyThe build for this PR has been completed successfully. A live preview will be available at: https://docs.mume.org/pr-10/ |
Contributor
There was a problem hiding this comment.
Hey - I've left some high level feedback:
- There is now duplicated and slightly divergent logic for deriving the preview/base hostname (in
scripts/ci-env.shand thedeploy.ymlGitHub Script step); consider consolidating this into a single source of truth or at least mirroring the same owner/repo/CNAME handling to avoid subtle drift between environments. - The hardcoded checks for
mume(both in bash and workflow YAML) make this logic less reusable; you could centralize the canonical owner name in a single environment variable or workflow input so forks or future owner changes don’t require touching multiple conditionals.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- There is now duplicated and slightly divergent logic for deriving the preview/base hostname (in `scripts/ci-env.sh` and the `deploy.yml` GitHub Script step); consider consolidating this into a single source of truth or at least mirroring the same owner/repo/CNAME handling to avoid subtle drift between environments.
- The hardcoded checks for `mume` (both in bash and workflow YAML) make this logic less reusable; you could centralize the canonical owner name in a single environment variable or workflow input so forks or future owner changes don’t require touching multiple conditionals.Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
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.
Summary by Sourcery
Adjust preview and deployment URL handling to work correctly for forks and GitHub Pages setups while restricting custom domain usage to the main repository.
Enhancements: