Skip to content

docfx: sync from repo-template (gh-pages bootstrap fix)#28

Closed
Chris-Wolfgang wants to merge 1 commit into
protected/vnextfrom
fix/docfx-bootstrap-gh-pages
Closed

docfx: sync from repo-template (gh-pages bootstrap fix)#28
Chris-Wolfgang wants to merge 1 commit into
protected/vnextfrom
fix/docfx-bootstrap-gh-pages

Conversation

@Chris-Wolfgang

Copy link
Copy Markdown
Owner

Summary

Sync .github/workflows/docfx.yaml from repo-template to 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-pages branch did not yet exist on the remote, $WORK_DIR was created as a plain directory and the subsequent git add / diff --cached / commit / push failed with fatal: not a git repository. The fix initializes the directory as a git repo on gh-pages and adds the authenticated origin remote, so the existing add/commit/push works on a first-ever deploy. Cleanup also branches between git worktree remove (worktree path) and Remove-Item (fresh-repo path).

If gh-pages already 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

  • Workflow YAML lints / next docs deploy succeeds
  • (Optional) verify gh-pages is unaffected

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>
Copilot AI review requested due to automatic review settings May 9, 2026 17:17

Copilot AI left a comment

Copy link
Copy Markdown

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.

Syncs the DocFX GitHub Pages deployment workflow with the template to fix first-time deployments when gh-pages doesn’t exist yet, by bootstrapping a valid git repo in $WORK_DIR and adjusting cleanup behavior.

Changes:

  • Add a “fresh repo” bootstrap path that runs git init on gh-pages and adds origin when the remote branch doesn’t exist.
  • Track branch existence via $useWorktree and branch cleanup between git worktree remove vs Remove-Item.
  • Explicitly reset $LASTEXITCODE after cleanup to avoid step failures due to cleanup commands.

Comment thread .github/workflows/docfx.yaml
Comment thread .github/workflows/docfx.yaml
Comment thread .github/workflows/docfx.yaml
@Chris-Wolfgang Chris-Wolfgang changed the base branch from main to protected/vnext June 8, 2026 17:08
@Chris-Wolfgang

Copy link
Copy Markdown
Owner Author

Superseded by the canonical maintenance baseline #64. The gh-pages bootstrap fix from repo-template#337 (init the work dir as a git repo on gh-pages when the branch doesn't exist, branch cleanup between git worktree remove and Remove-Item) is already present in vNext's docfx.yaml (git init --initial-branch=gh-pages + branchExists logic). Nothing left to apply — closing.

@Chris-Wolfgang Chris-Wolfgang deleted the fix/docfx-bootstrap-gh-pages branch June 9, 2026 01:07
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.

2 participants