docfx: sync from repo-template (gh-pages bootstrap fix)#66
Merged
Conversation
Sync .github/workflows/docfx.yaml from canonical repo-template to pick up the bootstrap fix from Chris-Wolfgang/repo-template#337. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Syncs the DocFX GitHub Pages deployment workflow with the upstream repo-template fix to correctly bootstrap a first-time gh-pages publish and clean up appropriately afterward.
Changes:
- Detect branch existence into a dedicated
$useWorktreeflag to drive bootstrap vs worktree logic. - Bootstrap a fresh
gh-pagesgit repository (init + remote) when the remote branch doesn’t exist. - Make cleanup conditional (remove worktree vs delete directory) and reset
$LASTEXITCODEafter cleanup.
This was referenced Jun 26, 2026
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
Sync
.github/workflows/docfx.yamlfromrepo-templateto pick up the gh-pages bootstrap fix from Chris-Wolfgang/repo-template#337.What changed
The "Deploy docs to GitHub Pages" step had a latent bug: when the
gh-pagesbranch did not yet exist on the remote,$WORK_DIRwas created as a plain directory and the subsequentgit add/diff --cached/commit/pushfailed withfatal: not a git repository. The fix initializes the directory as a git repo ongh-pagesand adds the authenticatedoriginremote, so the existing add/commit/push works on a first-ever deploy. Cleanup also branches betweengit worktree remove(worktree path) andRemove-Item(fresh-repo path).If
gh-pagesalready exists in this repo (the common case), this change is a no-op at runtime — the bootstrap branch is only taken on a fresh repo.Test plan
gh-pagesis unaffected