fix: load Dashboard correctly on private and Enterprise GitHub Pages#87
Conversation
Why Dashboard builds and PR report links derived the Pages URL from the repository name, assuming the canonical <owner>.github.io/<repo> layout. Private and Enterprise Pages sites are served from obfuscated *.pages.github.io domains at the root path, so every asset reference, notes fetch, and Open Dashboard link pointed at a /<repo>/ prefix that does not exist and returned 404. The action now resolves the actual Pages URL from the Pages API with the workflow token, callers can override it with the new pages_base_url input, and the previous repository-name layout remains the fallback when neither source is available. User impact Dashboards deployed from private or GitHub Enterprise Cloud repositories load with styles, scripts, and note data, and PR report Open Dashboard links point at the real Pages domain. Public repositories on the canonical layout are unaffected. Verification npm test --prefix packages/dashboard (38 passed) npm run dashboard:build npm -w packages/pr-report test (51 passed) npm -w packages/pr-report run build npm -w packages/cli run build npm -w packages/cli run typecheck npm -w packages/cli run lint npm -w packages/cli test (491 passed) Release note: Dashboards published from private or Enterprise GitHub Pages now load correctly, and a new pages_base_url action input can override the resolved Pages URL. Agentnote-Session: 4a6d322d-5afe-45e3-a11b-cf15d0e740a9
📝 WalkthroughWalkthroughAdds an optional pages_base_url action input, resolves the actual GitHub Pages URL via the Pages REST API (with override/fallback support) in both the dashboard build workflow and the PR report action, and uses that resolved URL to compute correct asset base paths and dashboard links instead of a repo-name heuristic. ChangesPages Base URL Resolution
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Action as GitHub Action (action.yml)
participant Resolver as resolvePagesBaseUrl
participant PagesAPI as GitHub Pages API
participant Consumer as build-pages.mjs / pr-report index.ts
Action->>Resolver: pages_base_url input / token
alt override provided and valid
Resolver-->>Action: return override URL
else query API
Resolver->>PagesAPI: GET /repos/{owner}/{repo}/pages
PagesAPI-->>Resolver: html_url or error
Resolver-->>Action: return html_url or null
end
Action->>Consumer: pass resolved pagesBaseUrl
Consumer->>Consumer: derive site/base or dashboard_url from pagesBaseUrl
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
Re-serialize pages_base_url values through the URL parser so control characters cannot corrupt the GITHUB_OUTPUT file, and document the new input in the README. Release note: skip Agentnote-Session: 4a6d322d-5afe-45e3-a11b-cf15d0e740a9
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 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 `@packages/pr-report/src/index.ts`:
- Around line 150-165: The Octokit Pages lookup in resolvePagesBaseUrl has no
explicit request timeout, so a slow Pages API call can hang the PR report
action. Update the octokit.request call in the Pages metadata fetch path to pass
a request timeout consistent with the dashboard script’s 10-second limit, while
keeping the existing fallback behavior in the catch block unchanged.
🪄 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: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro Plus
Run ID: 85bfde9f-085b-4e22-9e1e-ab79d9709548
⛔ Files ignored due to path filters (2)
packages/cli/dist/cli.jsis excluded by!**/dist/**,!**/dist/**packages/pr-report/dist/index.jsis excluded by!**/dist/**,!**/dist/**
📒 Files selected for processing (8)
action.ymlpackages/dashboard/workflow/build-pages.mjspackages/dashboard/workflow/resolve-pages-target.mjspackages/dashboard/workflow/resolve-pages-target.test.mjspackages/pr-report/src/github.tspackages/pr-report/src/index.test.tspackages/pr-report/src/index.tspackages/pr-report/src/report.ts
Octokit requests have no default timeout, so a hung Pages API call could block the PR report until the job timeout. Pass an abort signal matching the dashboard script's bound. Addresses CodeRabbit review feedback on PR #87. Release note: skip Agentnote-Session: 4a6d322d-5afe-45e3-a11b-cf15d0e740a9
Summary
GET /repos/{owner}/{repo}/pages→html_url) inresolve-pages-target.mjs, using thegithub.tokenthe composite action already has (pages: writein the generated Dashboard workflow includes read)SITE/BASEvalues from the resolved URL inbuild-pages.mjs, keeping the<owner>.github.io/<repo>heuristic as the fallback when the API is unavailablepages_base_urlaction input as an explicit override for both Dashboard builds and PR reportsinferDashboardUrlsoOpen Dashboard ↗links point at the real Pages domain (the PR Report workflow lackspages: readby default, so it falls back to the heuristic unless the permission or the input is provided)Root cause
build-pages.mjsconstructedsite/basemechanically from the repository name. Private / GHEC Pages sites are served from obfuscated*.pages.github.iodomains at the root path, so every stylesheet, script, favicon, andnotes/*.jsonreference pointed at a nonexistent/<repo>/prefix and 404'd, rendering the dashboard as unstyled HTML.PUBLIC_REPOwas pinned inaction.yml, leaving callers no workaround.User impact
Dashboards deployed from private or GitHub Enterprise Cloud repositories load with CSS, JS, and note data applied. Public repositories on the canonical layout are unaffected: when the Pages API resolves the same canonical URL the output is identical, and when the API is unreachable the previous heuristic still applies.
Validation
derivePagesPathsroot-domain/project-path/fallback/invalid cases,resolvePagesBaseUrloverride/API/failure/no-credential cases)inferDashboardUrlcases with resolved base URLs)PUBLIC_REPOonly, noPAGES_BASE_URL)Closes #86
🧑💬🤖 Agent Note
Total AI Ratio: ████████ 100%
Model:
claude-fable-531f6e8cfix(action): resolve the real Pages URL for Dashboard links and assets048e00dfix(action): normalize resolved Pages URLs before writing step outputs8c70e3bfix(action): bound the PR report Pages API lookup to 10 seconds💬 Prompts & Responses (10 shown / 14 total)
31f6e8cfix(action): resolve the real Pages URL for Dashboard links and assets🧑 Prompt
🧑 Prompt
🧑 Prompt
🧑 Prompt
🧑 Prompt
🧑 Prompt
🧑 Prompt
🧑 Prompt
048e00dfix(action): normalize resolved Pages URLs before writing step outputs🧑 Prompt
8c70e3bfix(action): bound the PR report Pages API lookup to 10 seconds🧑 Prompt
Summary by CodeRabbit
New Features
Bug Fixes
Tests