File tree Expand file tree Collapse file tree 1 file changed +16
-7
lines changed
Expand file tree Collapse file tree 1 file changed +16
-7
lines changed Original file line number Diff line number Diff line change @@ -20,14 +20,23 @@ cd "$ROOT_DIR"
2020UPSTREAM_REPO=" https://github.com/github/copilot-sdk.git"
2121ENV_FILE=" $ROOT_DIR /.merge-env"
2222
23- # ── 1. Create branch ──────────────────────────────────────────
24- echo " ▸ Ensuring we are on main and up to date…"
25- git checkout main
26- git pull origin main
23+ # ── 1. Create branch (or reuse existing) ─────────────────────
24+ CURRENT_BRANCH=$( git rev-parse --abbrev-ref HEAD)
2725
28- BRANCH_NAME=" merge-upstream-$( date +%Y%m%d) "
29- echo " ▸ Creating branch: $BRANCH_NAME "
30- git checkout -b " $BRANCH_NAME "
26+ if [[ " $CURRENT_BRANCH " != " main" ]]; then
27+ # Already on a non-main branch (e.g., coding agent's auto-created PR branch).
28+ # Stay on this branch — do not create a new one.
29+ BRANCH_NAME=" $CURRENT_BRANCH "
30+ echo " ▸ Already on branch '$BRANCH_NAME ' — reusing it (coding agent mode)."
31+ git pull origin main --no-edit 2> /dev/null || echo " (pull from main skipped or fast-forward not possible)"
32+ else
33+ echo " ▸ Ensuring main is up to date…"
34+ git pull origin main
35+
36+ BRANCH_NAME=" merge-upstream-$( date +%Y%m%d) "
37+ echo " ▸ Creating branch: $BRANCH_NAME "
38+ git checkout -b " $BRANCH_NAME "
39+ fi
3140
3241# ── 2. Update Copilot CLI ────────────────────────────────────
3342echo " ▸ Updating Copilot CLI…"
You can’t perform that action at this time.
0 commit comments