Skip to content

Migrate Copilot PAT pool to shared workflow import#54235

Open
jeffhandley wants to merge 4 commits into
dotnet:mainfrom
jeffhandley:jeffhandley/pat-pool-updates
Open

Migrate Copilot PAT pool to shared workflow import#54235
jeffhandley wants to merge 4 commits into
dotnet:mainfrom
jeffhandley:jeffhandley/pat-pool-updates

Conversation

@jeffhandley
Copy link
Copy Markdown
Member

Replaces the per-workflow inline select-copilot-pat action with the shared pat_pool.md now usable with in gh-aw v0.71.5. The new pattern fixes a bug where COPILOT_PAT_0 was always selected because activation needs: did not incorporate jobs referenced in engine.env expressions (github/gh-aw#30232, fixed in v0.71.5).

Also adds a workflow that monitors the PAT pool health.

jeffhandley and others added 3 commits May 7, 2026 23:52
Replaces the per-workflow inline `select-copilot-pat` action with the
shared `pat_pool.md` now usable with in gh-aw v0.71.5. The new pattern
fixes a bug where `COPILOT_PAT_0` was always selected because activation
`needs:` did not incorporate jobs referenced in `engine.env` expressions
(github/gh-aw#30232, fixed in v0.71.5).

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Adds a scheduled workflow that runs daily at ~2:17 AM UTC and validates each Copilot PAT in the pool by issuing a low-effort Copilot CLI request. Reports per-PAT status (valid / empty / invalid / unknown) in the job step summary, and fails the run when any PAT is invalid, the pool is empty, or transient errors prevent verification.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@jeffhandley jeffhandley requested a review from marcpopMSFT May 8, 2026 07:13
@jeffhandley jeffhandley self-assigned this May 8, 2026
Copilot AI review requested due to automatic review settings May 8, 2026 07:13
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR migrates Copilot PAT selection from a repo-local composite action to a shared Agentic Workflows import (shared/pat_pool.md), leveraging gh-aw v0.71.5 behavior to correctly wire needs: from engine.env references. It also adds a scheduled workflow to validate PAT pool health.

Changes:

  • Added a reusable pat_pool workflow import + README for selecting a random PAT index (0–9) from repository secrets.
  • Updated an existing agentic workflow to import pat_pool and use its output when overriding COPILOT_GITHUB_TOKEN, regenerating the compiled .lock.yml.
  • Added a scheduled/manual workflow to validate each PAT in the pool via Copilot CLI, and added repo config files to support/lock workflow dependencies.

Reviewed changes

Copilot reviewed 10 out of 10 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
.github/workflows/validate-pat-pool.yml New scheduled/manual workflow that checks each COPILOT_PAT_# by making a lightweight Copilot CLI request and summarizes pool health.
.github/workflows/shared/pat_pool.README.md Documentation for onboarding, PAT management, security model, and consumption pattern for the shared PAT pool import.
.github/workflows/shared/pat_pool.md New gh-aw import defining a pat_pool job that selects an available PAT slot and outputs pat_number.
.github/workflows/add-tactics-template-on-comment.md Switches from inline PAT selection to importing shared/pat_pool.md and using needs.pat_pool.outputs.pat_number in the token override.
.github/workflows/add-tactics-template-on-comment.lock.yml Regenerated compiled workflow reflecting gh-aw v0.71.5 and the new pat_pool import/job graph.
.github/mcp.json Adds an MCP server config for running the gh-aw MCP server via gh aw mcp-server.
.github/aw/actions-lock.json Updates/pins additional action versions used by the regenerated workflow.
.github/actions/select-copilot-pat/README.md Removes the old per-repo composite action documentation (superseded by shared import docs).
.github/actions/select-copilot-pat/action.yml Removes the old composite action implementation (superseded by shared import).
.gitattributes Marks *.lock.yml workflows as generated and sets merge=ours to reduce churn/conflicts.

Comment thread .github/workflows/shared/pat_pool.md Outdated
Comment thread .github/workflows/shared/pat_pool.md
Comment thread .github/workflows/shared/pat_pool.README.md Outdated
Comment thread .github/workflows/shared/pat_pool.README.md
Comment thread .github/workflows/validate-pat-pool.yml
Comment thread .github/workflows/validate-pat-pool.yml
@jeffhandley
Copy link
Copy Markdown
Member Author

/ba-g unrelated errors

2 similar comments
@marcpopMSFT
Copy link
Copy Markdown
Member

/ba-g unrelated errors

@jeffhandley
Copy link
Copy Markdown
Member Author

/ba-g unrelated errors

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants