elastic / elastic/ai-github-actions

[product-manager-impersonator] Reuse existing COPILOT_GITHUB_TOKEN in quick setup reruns

Open
#1,251 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` reuse an already-configured `COPILOT_GITHUB_TOKEN` secret by default, and only prompt/write a new token when explicitly requested.

## Why a Customer Would Want This
Teams frequently rerun quick setup to add workflows or refresh triggers. Today reruns can still require token handling even when the repository already has `COPILOT_GITHUB_TOKEN`, which adds friction to an otherwise fast onboarding/update path.

## Rough Implementation Sketch
- Add a repo-secret existence check before the token prompt/write path (for example via `gh secret list --repo "$repo"`).
- If `COPILOT_GITHUB_TOKEN` already exists, skip prompt + `gh secret set` and print a clear "reusing existing secret" message.
- Add an opt-in flag (for example `--force-secret-update`) to intentionally rotate/reset the secret when desired.
- Keep existing `--skip-secret` and `--dry-run` behavior intact.

## Why It Won't Be That Hard
This is a small, isolated enhancement in one script (`scripts/quick-setup.sh`) with centralized option parsing and a single secret-management block, so the change is mostly a conditional branch plus a new flag and help text.

## Evidence
- `scripts/quick-setup.sh:L23-L30` documents existing flags; there is no secret-reuse or force-update mode.
- `scripts/quick-setup.sh:L215-L251` enters secret handling whenever `--skip-secret` is false, and writes the secret with `gh secret set`.
- `scripts/quick-setup.sh:L241-L243` errors in non-interactive mode when no env token is set, even though a repo secret may already exist.
- `README.md:L37-L39` positions quick setup as streamlined end-to-end install, so reducing rerun friction aligns with product expectations.
- Related but distinct existing ideas: `#809` (permission preflight), `#888` (existing-file overwrite policy), `#1220` (first-run checklist).

> [!NOTE]
>
> 🔒 Integrity filter blocked 43 items
>
> The following items were blocked because they don't meet the GitHub integrity level.
>
> - [#1175](https://github.com/elastic/ai-github-actions/pull/1175) `list_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#359](https://github.com/elastic/ai-github-actions/issues/359) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#505](https://github.com/elastic/ai-github-actions/issues/505) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#476](https://github.com/elastic/ai-github-actions/issues/476) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#1067](https://github.com/elastic/ai-github-actions/issues/1067) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#704](https://github.com/elastic/ai-github-actions/issues/704) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#694](https://github.com/elastic/ai-github-actions/issues/694) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#684](https://github.com/elastic/ai-github-actions/issues/684) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#547](https://github.com/elastic/ai-github-actions/issues/547) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#153](https://github.com/elastic/ai-github-actions/issues/153) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#424](https://github.com/elastic/ai-github-actions/issues/424) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#239](https://github.com/elastic/ai-github-actions/issues/239) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#459](https://github.com/elastic/ai-github-actions/pull/459) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#600](https://github.com/elastic/ai-github-actions/pull/600) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#1175](https://github.com/elastic/ai-github-actions/pull/1175) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#1128](https://github.com/elastic/ai-github-actions/pull/1128) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - ... and 27 more items
>
> To allow these resources, lower `min-integrity` in your GitHub frontmatter:
>
> ```yaml
> tools:
> github:
> min-integrity: approved # merged | approved | unapproved | none
> ```
>
>

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

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.