elastic / elastic/ai-github-actions

[product-manager-impersonator] Quick setup remote branch collision handling

Open
#1,861 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
11
Forks
16
Avg merge
22h 9m
Merged PRs (30d)
31

Description

## Feature Idea

**Summary:** Make `scripts/quick-setup.sh` detect existing remote setup branches and choose a safe branch strategy (track existing or auto-suffix) before doing work.

## Why a Customer Would Want This
Users running quick setup in shared repositories can hit branch-name collisions on the default `ai-gh-aw-setup` branch. Today the script can proceed through setup and only fail at push time, which is frustrating and wastes time for first-time adopters.

## Rough Implementation Sketch
- Add a preflight check for `origin/` existence immediately after resolving `default_branch`.
- If remote exists and local branch does not, track the existing remote branch; otherwise allow an auto-suffix strategy (for example `ai-gh-aw-setup-2`) when requested.
- Print a clear message showing which branch strategy was selected.
- Keep the existing `--branch` override as highest priority.

## Why It Won't Be That Hard
The script already centralizes branch selection and checkout logic in one place, so this is a focused extension to existing conditionals rather than a broad refactor.

## Evidence
- Default setup branch is fixed to `ai-gh-aw-setup` in `scripts/quick-setup.sh` (line 11).
- Branch existence handling currently checks only local refs (`git show-ref --verify --quiet "refs/heads/$branch"`) in `scripts/quick-setup.sh` (lines 172-176).
- Push always targets `origin/$branch` in `scripts/quick-setup.sh` (line 225), which is where remote-name collisions surface.
- Quick setup docs emphasize the standard setup branch flow in `README.md` (lines 37-39).

---
[What is this?](https://ela.st/github-ai-tools) | [From workflow: Trigger Product Manager Impersonator](https://github.com/elastic/ai-github-actions/actions/runs/32240979631)

Give us feedback! React with 🚀 if perfect, 👍 if helpful, 👎 if not.

Contributor guide

Open the contributing guide

Research direction

Start in scripts/quick-setup.sh, especially the default_branch resolution, local branch checks around lines 172-176, and the push near line 225; review README.md lines 37-39 for the documented flow. Run the quick-setup path against repositories with and without origin/ai-gh-aw-setup, then verify --branch remains highest priority, the selected strategy is clearly reported, and setup no longer waits until push to expose a collision.

Written by the indexing model from the issue text.

Assessment

Tech stack
git, shell
Domain
cli, devops
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.