fix: unshallow git history before Lunaria build to prevent CI failures on new docs#707
Conversation
…s on new docs Agent-Logs-Url: https://github.com/microsoft/aspire.dev/sessions/1a698765-6fb4-4021-9101-9f7d2562c78b Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
|
Hey @copilot, I'm confused - how is this different than |
Great question. They're subtly different in practice.
This is observable right here in this sandbox — the repo was checked out with
|
|
Follow-up to the earlier root-cause explanation: we verified that the previous comment overstated the scope. This is not "all PRs" and it is not just a generic What we found:
Those two commands are not equivalent. In a simulated
That explains why PR #705 could still fail even though this PR's approach is directionally correct. |
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Ensures the frontend-build workflow has a non-shallow git checkout so Lunaria can resolve commit history for newly added docs files, preventing CI failures on PRs.
Changes:
- Adds a post-checkout
git fetch --unshallowstep to force a full history in CI when needed.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| fetch-depth: 0 | ||
|
|
||
| - name: Ensure full git history for Lunaria | ||
| run: git fetch --unshallow 2>/dev/null || true |
There was a problem hiding this comment.
Redirecting all stderr to /dev/null and then forcing success with || true can hide real fetch failures (e.g., network/auth/remote issues), making CI logs misleading and harder to debug. Prefer an explicit shallow-check gate (e.g., read git rev-parse --is-shallow-repository) and only run git fetch --unshallow when needed, while allowing unexpected errors to surface (or at least logging them). If cross-runner portability matters, also consider ensuring a bash shell is used (since 2>/dev/null is shell-specific).
| run: git fetch --unshallow 2>/dev/null || true | |
| shell: bash | |
| run: | | |
| if [[ "$(git rev-parse --is-shallow-repository)" == "true" ]]; then | |
| git fetch --unshallow | |
| else | |
| echo "Repository already has full git history." | |
| fi |
…s on new docs (#707) Agent-Logs-Url: https://github.com/microsoft/aspire.dev/sessions/1a698765-6fb4-4021-9101-9f7d2562c78b Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
…s on new docs (#707) Agent-Logs-Url: https://github.com/microsoft/aspire.dev/sessions/1a698765-6fb4-4021-9101-9f7d2562c78b Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: IEvangelist <7679720+IEvangelist@users.noreply.github.com>
Summary
Fixes a subset of
frontend-buildPR CI failures where Lunaria cannot retrieve git history for a newly added docs page during the/i18nbuild.Observed behavior
The failure looks like:
What we confirmed
src/frontend/src/frontendpath is Lunaria's shallow-repo fallback path.refs/pull/N/merge),git fetch --unshallowrestores the missing history for those files.Root cause
When
@lunariajs/starlightsees a shallow repository, it calls Lunaria'shandleShallowRepo()path. That path clones repository history and prefixesrepository.rootDirbefore file history lookups. For a docs page that only exists on the PR branch, that fallback cannot resolve history frommain, so the build exits during/i18n.The doubled path is a symptom of that fallback path, not a separate bug.
Fix
Add this step immediately after
actions/checkoutinfrontend-build.yml:The important distinction is that we must fetch the missing history, not just clear the shallow marker.
Impact