elastic / elastic/ai-github-actions

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

Open
#1,152 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:** Add a quick-setup mode that reuses an already-configured `COPILOT_GITHUB_TOKEN` repository secret so reruns can proceed without requiring token re-entry.

## Why a Customer Would Want This
Teams often rerun quick setup to add or refresh workflow files after initial adoption. Today, reruns can still stop at token acquisition even when the repository secret already exists, which creates avoidable friction in CI-like or non-interactive environments.

## Rough Implementation Sketch
- In `scripts/quick-setup.sh`, before prompting for a token, check whether `COPILOT_GITHUB_TOKEN` already exists in the target repo (via `gh secret list --repo ...`).
- If the secret exists and no explicit override is provided, skip prompt/set and continue with a clear log message (for example: "Reusing existing COPILOT_GITHUB_TOKEN secret").
- Add an opt-in override flag (for example `--force-secret-update`) to keep explicit rotation behavior available.
- Document the rerun behavior in `README.md` quick setup text and script help output.

## Why It Won't Be That Hard
This is a small, localized change in one script path: token handling already centralizes under `--skip-secret` logic, so adding a pre-check branch and one optional override flag should not require compiler or workflow schema changes.

## Evidence
- Current token flow exits in non-interactive runs when env token is absent, with no existing-secret reuse path: `scripts/quick-setup.sh#L215-L244`.
- The script unconditionally calls secret set when a token value is present, rather than first detecting an existing repo secret: `scripts/quick-setup.sh#L247-L249`.
- The project positions quick setup as a primary onboarding and install path: `README.md#L28-L39`.
- Recent activity shows ongoing setup/token friction around quick setup behavior and docs clarity (e.g., `#1071`, `#1144`, `#1148`, `#1145`).

> [!NOTE]
>
> 🔒 Integrity filter blocked 40 items
>
> The following items were blocked because they don't meet the GitHub integrity level.
>
> - [#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".
> - [#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".
> - [#1128](https://github.com/elastic/ai-github-actions/pull/1128) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - elastic/ai-github-actions#1067 `list_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - elastic/ai-github-actions#1025 `list_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - elastic/ai-github-actions#875 `list_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#687](https://github.com/elastic/ai-github-actions/pull/687) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#659](https://github.com/elastic/ai-github-actions/pull/659) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#312](https://github.com/elastic/ai-github-actions/pull/312) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#703](https://github.com/elastic/ai-github-actions/pull/703) `search_pull_requests`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#140](https://github.com/elastic/ai-github-actions/issues/140) `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".
> - [#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".
> - [#432](https://github.com/elastic/ai-github-actions/issues/432) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#457](https://github.com/elastic/ai-github-actions/issues/457) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - [#436](https://github.com/elastic/ai-github-actions/issues/436) `search_issues`: has lower integrity than agent requires. The agent cannot read data with integrity below "approved".
> - ... and 24 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/26283913636)

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.