Skip to content

Set up GitHub Agentic Workflows#126057

Merged
jeffhandley merged 6 commits intodotnet:mainfrom
jeffhandley:jeffhandley/agentic-workflows
Mar 25, 2026
Merged

Set up GitHub Agentic Workflows#126057
jeffhandley merged 6 commits intodotnet:mainfrom
jeffhandley:jeffhandley/agentic-workflows

Conversation

@jeffhandley
Copy link
Copy Markdown
Member

This pull request introduces support for securely running GitHub Agentic Workflows with Copilot by implementing a mechanism to randomly select a Copilot Personal Access Token (PAT) from a pool of secrets, mitigating rate-limiting issues. It also adds documentation and a test workflow for this setup, and adds the gh-aw infrastructure to the repo.

Copilot PAT Pool Selection:

  • Added a reusable composite GitHub Action (.github/actions/select-copilot-pat/action.yml) that selects a random Copilot PAT from up to 10 provided secrets (COPILOT_PAT_0 through COPILOT_PAT_9), with optional deterministic selection via a random seed. If no PATs are available, it gracefully falls back to the default token. If needed, workflows can have their own pools of secrets to draw from.
  • Provided detailed usage and onboarding instructions for the PAT pool action in .github/actions/select-copilot-pat/README.md, including setup, PAT management, and workflow integration guidance.
  • Integrated the PAT pool selection mechanism into a sample agentic workflow (.github/workflows/copilot-echo.md) to demonstrate and validate the approach. The workflow uses the selected PAT for Copilot authentication and includes clear documentation for its purpose and usage.

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

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

Adds initial infrastructure and example workflow for running GitHub Agentic Workflows (gh-aw) with GitHub Copilot, including a composite action to randomly select a Copilot PAT from a secret pool to reduce rate-limit pressure.

Changes:

  • Added a composite action to select a Copilot PAT from up to 10 provided secrets (with optional seeding).
  • Added a sample agentic workflow (copilot-echo) plus its generated lock file to validate the setup end-to-end.
  • Added repo scaffolding for gh-aw (agent descriptor, action lock metadata, and git attributes for generated lock files).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/copilot-echo.md New agentic workflow source that demonstrates PAT-pool selection and uses the selected token for Copilot auth.
.github/workflows/copilot-echo.lock.yml Generated compiled workflow produced by gh aw compile for execution in GitHub Actions.
.github/actions/select-copilot-pat/action.yml Composite action that selects an available PAT number from SECRET_0..SECRET_9.
.github/actions/select-copilot-pat/README.md Onboarding and usage documentation for the PAT pool action.
.github/aw/actions-lock.json Locks key third-party action references used by gh-aw workflows.
.github/agents/agentic-workflows.agent.md Adds an agent descriptor/dispatcher document for gh-aw-related tasks.
.gitattributes Marks .lock.yml files as generated and resolves merges using ours.

jeffhandley and others added 2 commits March 24, 2026 15:06
Instruct the agentic workflows agent to automatically include the
select-copilot-pat integration (steps, job outputs, engine config,
and explanatory comment block) when creating or updating workflows.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings March 24, 2026 22:40
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

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

@jeffhandley
Copy link
Copy Markdown
Member Author

/ba-g No runs apply

Copy link
Copy Markdown
Member

@ericstj ericstj left a comment

Choose a reason for hiding this comment

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

We've worked together on this solution and I approve of the technique - I had one small suggestion for reducing boilerplate but I'm not sure it works.

@jeffhandley
Copy link
Copy Markdown
Member Author

/ba-g No runs apply

@jeffhandley jeffhandley merged commit e5f6bf5 into dotnet:main Mar 25, 2026
15 of 21 checks passed
@jeffhandley jeffhandley deleted the jeffhandley/agentic-workflows branch March 25, 2026 00:53
marcpopMSFT added a commit to marcpopMSFT/sdk that referenced this pull request Mar 26, 2026
Replace the GitHub Models inference API (models.inference.ai.azure.com)
with the Copilot API (api.githubcopilot.com), authenticated via a
randomly selected PAT from a pool of repository secrets.

This follows the pattern established in dotnet/runtime#126057:
- Add select-copilot-pat composite action that picks a random PAT
  from COPILOT_PAT_0..9 secrets to mitigate rate-limiting
- Add select-pat job to the workflow pipeline
- Remove models:read permission (no longer needed)
- Sanitize error responses to prevent token leakage in logs
- Fail explicitly with setup instructions when no PATs are configured

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants