elastic / elastic/ai-github-actions

[product-manager-impersonator] Quick setup repo-target consistency guard

Open
#1,899 0 comments 1 reaction 2 assignees Claimed by @v1v View on GitHub
Dominant language
Python
Stars
11
Forks
16
Avg merge
22h 9m
Merged PRs (30d)
31

Description

## Feature Idea

**Summary:** Add a quick-setup preflight that fails fast when `--repo` does not match the checked-out repository remote, with a clear remediation message.

## Why a Customer Would Want This
Maintainers use the quick setup script as the primary onboarding path, and they expect it to target exactly the repository they are currently in. Today, `--repo` controls default-branch lookup and PR target, while git operations still use local `origin`, which can lead to confusing cross-repo behavior and hard-to-diagnose failures.

## Rough Implementation Sketch
- In `scripts/quick-setup.sh`, resolve the local repository identity from `origin` (or `gh repo view` fallback) before branch operations.
- When `--repo` is set and differs from the local repo identity, exit with a clear error explaining the mismatch and how to fix it.
- Add an explicit opt-out flag (for advanced users) to allow intentional mismatch cases.
- Update quick-setup docs to describe the new guardrail and opt-out behavior.

## Why It Won't Be That Hard
This is a focused shell-script preflight plus docs update. The script already resolves repo metadata and centralizes argument parsing/errors, so adding one validation check is a small, additive change with minimal surface area.

## Evidence
- `scripts/quick-setup.sh:22` documents `--repo OWNER/REPO` as the target repository input.
- `scripts/quick-setup.sh:108-112` uses `--repo` to resolve the default branch.
- `scripts/quick-setup.sh:171-176` checks out from local `origin/$default_branch`.
- `scripts/quick-setup.sh:225-226` pushes to local `origin` and then opens a PR against `--repo`.
- `gh-agent-workflows/README.md:44-66` positions quick setup as the primary install path and advertises `--repo` usage.
- Recent repository activity shows ongoing quick-setup reliability work (`#1880`, `#1888`, `#1811`), indicating this aligns with current direction.

## Suggested Actions
- [ ] Add repo mismatch preflight and clear error text in `scripts/quick-setup.sh`.
- [ ] Add an explicit opt-out flag for intentional advanced workflows.
- [ ] Document the behavior in `README.md` and `gh-agent-workflows/README.md` quick-setup sections.
- [ ] Add a focused test/script validation case for mismatch behavior.

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

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.