You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Upgrade gh-aw to v0.79.8 and run agentic workflow in isolated environment (#5604)
* Upgrade gh-aw to v0.79.8 and run agentic workflow in isolated environment
- Add a validate-pat-pool workflow to monitor health of PAT pool
* Fix indentation
Copy file name to clipboardExpand all lines: .github/workflows/shared/pat_pool.README.md
+48-10Lines changed: 48 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@
2
2
3
3
Selects a random Copilot PAT from a numbered pool of secrets. This addresses limitations that arise from having a single PAT shared across all agentic workflows, such as rate-limiting.
4
4
5
-
**This is a stop-gap workaround.** As soon as organization/enterprise billing is offered for agentic workflows, this approach will be removed from our workflows.
5
+
**This is a stop-gap workaround.** As soon as organization/enterprise billing is available to the dotnet org, this approach will be removed from our workflows.
- Recommended Deployment branches and tags: **Protected branches only**
29
+
30
+
This environment is used for all agentic workflows, restricting agentic workflows to the repo's protected branches and preventing the workflows from accessing secrets defined for other environments.
31
+
22
32
## PAT Management
23
33
24
-
Team members provide PATs into the pools for the repository by adding them as repository secrets with secret names matching the pattern of `<pool_name>_<0-9>`, such as `COPILOT_PAT_0`.
34
+
Team members provide PATs into the pool with secret names matching the pattern of `{pool-name}_{0-9}`, such as `COPILOT_PAT_0`.
25
35
26
36
[Use this link to prefill the PAT creation form with the required settings][create-pat]:
27
37
@@ -32,12 +42,30 @@ Team members provide PATs into the pools for the repository by adding them as re
32
42
33
43
The **Token Name**_does not_ need to match the secret name and is only visible to the owner of the PAT. It's recommended to use a token name indicating the PAT is used for dotnet org agentic workflows. The **Description** is also only used for your own reference.
34
44
35
-
Team members providing PATs for workflows should set weekly recurring reminders to regenerate and update their PATs in the repository secrets. With an 8-day expiration, renewal can be done on the same day each week.
45
+
Team members providing PATs for workflows should set weekly recurring reminders to regenerate and update their PATs in the PAT pool. With an 8-day expiration, renewal can be done on the same day each week.
46
+
47
+
## PAT Pool Secrets
36
48
37
-
PATs are added to repositories through the **Settings > Secrets and variables > Actions** UI, saved as **Repository secrets** and matching the `<pool_name>_<0-9>` naming convention. This can also be done using the GitHub CLI.
49
+
For a PAT pool that is specific to an environment, PATs can be added to repositories as **Environment Secrets** for the environment created above. _This requires repo admin permission_.
50
+
51
+
***Settings** >
52
+
***Environments** >
53
+
***copilot-pat-pool** (or other environment name) >
54
+
***Add environment secret** (or edit your existing secret)
55
+
* Enter your secret name of `COPILOT_PAT_{0-9}` and paste in your PAT
56
+
57
+
This can also be accomplished using the `gh` CLI, specifying the repo and environment arguments.
38
58
39
59
```sh
40
-
gh aw secrets set"<pool_name>_<0-9>" --value "<your-github-pat>" --repo <org>/<repo>
60
+
# Register the PAT secret. This will prompt for you to paste the PAT.
It's also helpful to record who owns each PAT within the pool. To capture which team member is associated with each PAT, a `<pool_name>_<0-9>_<username>` "sidecar secret" can be added alongside the PAT secret to make the username for the PAT pool entry visible. This sidecar secret must have a non-empty value, but it's never consumed, so any value is sufficient.
65
+
66
+
```sh
67
+
# Record a sidecar secret that presents who owns this PAT.
The expression can be collapsed onto a single line if desired. `gh-aw compile` automatically wires `pat_pool` into the activation and agent jobs' `needs:` graph because of the `needs.pat_pool.` references within the `engine.env` property.
113
+
The `COPILOT_GITHUB_TOKEN` expression can be collapsed onto a single line if desired. `gh-aw compile` automatically wires `pat_pool` into the activation and agent jobs' `needs:` graph because of the `needs.pat_pool.` references within the `engine.env` property.
80
114
81
115
```sh
82
116
gh aw compile <workflow-name> --schedule-seed <org>/<repo>
83
117
```
84
118
119
+
### Specifying the environment
120
+
121
+
The `environment` must be specified both to the `pat_pool.md` import and to the containing workflow to ensure both jobs access the PAT pool from the same environment. The `copilot-pat-pool` environment name is recommended as the isolated environment for agentic workflows that use the PAT pool.
122
+
85
123
### Customizing the pool
86
124
87
125
The import declares 10 optional inputs (`COPILOT_PAT_0` through `COPILOT_PAT_9`), each defaulting to `secrets.COPILOT_PAT_#` of the matching number. To point a workflow at a different pool of repository secrets, use the parameterized `uses`/`with` form when importing and pass the substitute secrets as the `COPILOT_PAT_#` inputs:
@@ -101,7 +139,7 @@ The secrets passed via `with:` must match the secrets referenced in the consumin
This approach aligns with GitHub's documented guidance for [passing secrets][passing-secrets] between workflows, where the `pat_pool` job returns a PAT number and the `case` statement acts as a secret store to look the PAT secret up based on the selected number.
0 commit comments