Skip to content

fix: fetch PR head history for Lunaria builds#708

Merged
IEvangelist merged 2 commits intomainfrom
dapine/fix-lunaria-pr-history
Apr 13, 2026
Merged

fix: fetch PR head history for Lunaria builds#708
IEvangelist merged 2 commits intomainfrom
dapine/fix-lunaria-pr-history

Conversation

@IEvangelist
Copy link
Copy Markdown
Member

Summary

Follow up to #707 by fetching the PR head ref in the reusable frontend workflow before the Lunaria build.

Why

The earlier git fetch --unshallow change was necessary, but not sufficient for all pull request checkouts. We still have failing frontend-build runs where Lunaria logs:

[info] Shallow repository detected. A clone of your repository's history will be downloaded and used.

and then fails on a newly added docs page such as:

Root cause

On some PR merge checkouts (refs/pull/<n>/merge), Lunaria still sees the repository as shallow and switches into its fallback history path. That path cannot resolve git history for docs pages that only exist on the PR branch.

Fix

When this reusable workflow is running for a pull request, fetch:

refs/pull/<n>/head

explicitly, with --unshallow, before the frontend build. This makes the PR head history available even when the checkout was created from the merge ref.

For non-PR builds, keep the existing git fetch --unshallow fallback.

Validation

Simulated PR merge checkouts for the known failing cases:

Fetch the PR head ref in the reusable frontend workflow before the Lunaria build so PR merge checkouts stop falling back to shallow history for new docs pages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 13, 2026 19:14
@IEvangelist IEvangelist enabled auto-merge (squash) April 13, 2026 19:16
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the reusable frontend-build workflow to ensure Lunaria can access PR head history during PR merge checkouts by explicitly fetching the PR head ref before building.

Changes:

  • Add an optional pull_number input to the reusable frontend-build workflow.
  • For PR runs, fetch refs/pull/<n>/head (attempting --unshallow first) to make PR head history available to Lunaria.
  • Pass the PR number from ci.yml into the reusable workflow when the event is pull_request.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
.github/workflows/frontend-build.yml Adds pull_number input and PR-aware git fetch logic to ensure Lunaria sees PR head history.
.github/workflows/ci.yml Wires github.event.pull_request.number into the reusable frontend workflow for PR runs.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .github/workflows/frontend-build.yml Outdated
Comment thread .github/workflows/frontend-build.yml Outdated
Comment thread .github/workflows/frontend-build.yml Outdated
Validate the reusable workflow pull number input, use a clearer remote-tracking ref namespace, and avoid suppressing real fetch failures while still handling shallow PR merge checkouts correctly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@IEvangelist
Copy link
Copy Markdown
Member Author

Addressed the review feedback in the latest push:

  • validate pull_number as numeric before using it in the refspec
  • stop swallowing real git fetch failures
  • use a clearer refs/remotes/origin/pull/<n>/head destination ref and store the refspec in a variable

The guarded fetch path still reproduces correctly against the known failing PR shapes (#701 and #705): shallow true -> false, and the new docs page history is available after the fetch.

@IEvangelist IEvangelist merged commit eb219b5 into main Apr 13, 2026
5 checks passed
@IEvangelist IEvangelist deleted the dapine/fix-lunaria-pr-history branch April 13, 2026 22:43
JamesNK pushed a commit that referenced this pull request Apr 16, 2026
Fetch the PR head ref in the reusable frontend workflow before the Lunaria build so PR merge checkouts stop falling back to shallow history for new docs pages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
JamesNK pushed a commit that referenced this pull request Apr 21, 2026
Fetch the PR head ref in the reusable frontend workflow before the Lunaria build so PR merge checkouts stop falling back to shallow history for new docs pages.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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