Skip to content

Fix Bootstrap: replace gh pr create with REST API + branch propagation polling#23

Merged
einari merged 2 commits intomainfrom
copilot/fix-bootstrap-issue
Mar 8, 2026
Merged

Fix Bootstrap: replace gh pr create with REST API + branch propagation polling#23
einari merged 2 commits intomainfrom
copilot/fix-bootstrap-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 8, 2026

gh pr create --repo Cratis/$repo --head "$branch" fails with Head sha can't be blank, Base sha can't be blank, Head ref must be a branch on every repo because gh resolves --head against the local checkout (Cratis/Workflows), not the target repo.

Changes

  • Replace gh pr create with gh api -X POST repos/Cratis/$repo/pulls — the REST endpoint resolves the head branch in the target repo's context, no local git lookup involved. Uses plain branch name (correct for same-repo, non-fork PRs).

  • Replace fixed sleep 10 with branch propagation polling — polls GET /repos/Cratis/$repo/branches/$branch (same replica as the PR creation service) up to 6 × 10s before attempting PR creation. Skips PR creation with a warning if the branch isn't visible after 60s.

  • Reduce max_attempts from 4 → 3 — smarter pre-flight check makes excessive blind retries unnecessary.

# Before — resolves head branch from local Cratis/Workflows checkout → always blank
gh pr create --repo "Cratis/$repo" --head "$branch" --base "$default_branch"

# After — resolves head branch in target repo context via REST
gh api -X POST "repos/Cratis/$repo/pulls" \
  -f head="$branch" \
  -f base="$default_branch" \
  ...

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

…h propagation check

Co-authored-by: einari <134365+einari@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix Bootstrap not working issue Fix Bootstrap: replace gh pr create with REST API + branch propagation polling Mar 8, 2026
@einari einari marked this pull request as ready for review March 8, 2026 08:10
@einari einari merged commit 26620e3 into main Mar 8, 2026
@einari einari deleted the copilot/fix-bootstrap-issue branch March 8, 2026 08:10
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