workspace: bootstrap main first on empty repos#91
Merged
Conversation
…w has a base branch On a brand-new repo, GitHub makes the first pushed branch the default. Pushing the scaffold to a feature branch first made that the default branch and left no main to open the scaffold PR against. Instruct the skill to detect an uninitialized repo and seed main directly before using the feature-branch+PR flow. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
gas2own
added a commit
that referenced
this pull request
Jul 16, 2026
…ct URL on private repos) Two latent bugs in the reusable Quarto deploy workflow made a freshly scaffolded repo's first PR look broken (red deploy check, no/wrong preview link) even when the site published fine: 1. The preview-comment gh api read was unguarded under set -e; a transient 5xx HTML body breaks --jq and abORTS the deploy after publish. Now the block runs under set +e and closes on a guaranteed-success command. 2. The preview URL was hardcoded to <owner>.github.io/<repo>, dead on private/internal repos that serve from an obfuscated *.pages.github.io domain. Now resolved from the Pages API with fallback; deploy job and scaffold docs.yml template grant pages: read. Supersedes #91, #92, #93. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Make repo-created-with-initial-commit the preferred empty-repo bootstrap path, with direct seed-to-main as a fallback. Creating the repo with a README (GitHub UI checkbox or gh repo create --add-readme) means main exists from the start, needs no seed push, and works for every agent regardless of harness restrictions on pushing to a default branch. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Collapse the ~6-line bootstrap block into two terse bullets matching the file's house style — keep the check, the preferred create-with-README path, and the seed fallback; drop the repeated review-gate justification and the harness-specific parenthetical. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Why
While scaffolding a Quarto project into a brand-new empty repo, the workspace skill's headless-save flow pushed the scaffold to a feature branch first. On an uninitialized repo, GitHub makes the first pushed branch the default branch — so the feature branch wrongly became the default, and there was no
mainto open the scaffold PR against. The run got stuck: it couldn't follow the normal branch→PR flow, and flipping the default branch back tomainafterward needs Admin.Fix
Add an explicit empty-repo bootstrap step to the workspace skill's Save section: before the first save, detect whether the repo has a
mainyet (git ls-remote --heads origin main), and if not, establish the default branch before proceeding.The step now offers two paths, preferred first:
gh repo create --add-readme) somainexists from the start. This is the most robust path and works for every agent regardless of harness restrictions on pushing to a default branch — no seed push is ever needed. When guiding a user, the agent can point them at this.maindirectly (git push -u origin HEAD:main) if the repo already exists empty and can't be recreated. Seedingmainon an empty repo is a legitimate direct push (no prior state to review-gate).Subsequent iterations use the existing feature-branch + PR flow unchanged. This makes the skill robust to the empty-repo case so the wrong-default-branch state can't recur, and gives agents a harness-agnostic recommendation to hand users.
🤖 Generated with Claude Code