Skip to content

Commit 1afb557

Browse files
authored
docs: add org-owned repository instructions for COPILOT_GITHUB_TOKEN (#9821)
1 parent 2459dd9 commit 1afb557

1 file changed

Lines changed: 36 additions & 6 deletions

File tree

docs/src/content/docs/reference/tokens.md

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ For GitHub Agentic Workflows, you only need to create a few **optional** secrets
1414

1515
| When you need this… | Secret to create | Notes |
1616
|------------------------------------------------------|----------------------------------------|-------|
17-
| Copilot workflows (CLI, engine, agent sessions, etc.) | `COPILOT_GITHUB_TOKEN` | Needs Copilot Requests permission and repo access. |
17+
| Copilot workflows (CLI, engine, agent sessions, etc.) | `COPILOT_GITHUB_TOKEN` | Needs Copilot Requests permission. For org-owned repos, needs org permissions: Members (read-only), GitHub Copilot Business (read-only). |
1818
| Cross-repo Project Ops / remote GitHub tools | `GH_AW_GITHUB_TOKEN` | PAT or app token with cross-repo access. |
1919
| Assigning agents/bots to issues or pull requests | `GH_AW_AGENT_TOKEN` | Used by `assign-to-agent` and Copilot assignee/reviewer flows. |
2020
| Any GitHub Projects v2 operations | `GH_AW_PROJECT_GITHUB_TOKEN` | **Required** for `update-project`. Default `GITHUB_TOKEN` cannot access Projects v2 API. |
@@ -265,10 +265,31 @@ The recommended token for all Copilot-related operations including the Copilot e
265265

266266
**Setup**:
267267

268-
1. Create a [PAT](https://github.com/settings/personal-access-tokens/new) with:
269-
- Resource owner: Your user account (not organization)
270-
- Repository access: "Public repositories" or specific repos
271-
- Permissions: "Copilot Requests" (required)
268+
The required token type depends on whether you own the repository or an organization owns it:
269+
270+
**For User-owned Repositories**:
271+
272+
1. Create a [fine-grained PAT](https://github.com/settings/personal-access-tokens/new) with:
273+
- **Resource owner**: Your user account
274+
- **Repository access**: "Public repositories" or select specific repos
275+
- **Permissions**:
276+
- Copilot Requests: Read-only (required)
277+
278+
**For Organization-owned Repositories**:
279+
280+
When an organization owns the repository, you need a fine-grained PAT with organization-level permissions:
281+
282+
1. Create a [fine-grained PAT](https://github.com/settings/personal-access-tokens/new) with:
283+
- **Resource owner**: The organization that owns the repository
284+
- **Repository access**: Select the specific repositories that will use the workflow
285+
- **Repository permissions**:
286+
- Contents: Read (if needed for repository access)
287+
- Issues: Read (if needed for issue-triggered workflows)
288+
- Pull requests: Read (if needed for PR-triggered workflows)
289+
- **Organization permissions** (must be explicitly granted):
290+
- Members: Read-only (required)
291+
- GitHub Copilot Business: Read-only (required)
292+
- **Important**: You must explicitly grant organization access during token creation
272293

273294
2. Add to repository secrets:
274295

@@ -278,6 +299,14 @@ gh aw secrets set COPILOT_GITHUB_TOKEN --value "YOUR_COPILOT_PAT"
278299

279300
**Token precedence**: per-output → global safe-outputs → workflow-level → `COPILOT_GITHUB_TOKEN` → `GH_AW_GITHUB_TOKEN` (legacy, deprecated)
280301

302+
> [!NOTE]
303+
> Organization token requirements
304+
> For organization-owned repositories, the token must have both:
305+
> - **Members: Read-only** - Required to access organization member information
306+
> - **GitHub Copilot Business: Read-only** - Required to authenticate with Copilot services
307+
>
308+
> These organization permissions must be explicitly granted during token creation and may require approval from your organization administrator.
309+
281310
> [!CAUTION]
282311
> `GITHUB_TOKEN` is **not** included in the fallback chain (lacks "Copilot Requests" permission). `COPILOT_CLI_TOKEN` and `GH_AW_COPILOT_TOKEN` are **no longer supported** as of v0.26+.
283312

@@ -602,7 +631,8 @@ Specific fallback chains are documented in each token's section above. Note: Cop
602631
| Cross-repository read | Contents: Read |
603632
| Cross-repository issues | Issues: Read+Write, Contents: Read |
604633
| Cross-repository PRs | Pull requests: Read+Write, Contents: Read+Write |
605-
| Copilot operations | Copilot Requests (special permission) |
634+
| Copilot operations (user-owned repos) | Copilot Requests: Read-only |
635+
| Copilot operations (org-owned repos) | Copilot Requests: Read-only + Organization permissions: Members (read-only), GitHub Copilot Business (read-only) |
606636
| Agent assignments | Actions: Write, Contents: Write, Issues: Write, Pull requests: Write |
607637
| GitHub Projects v2 | Projects: Read+Write (org-level for org Projects) |
608638
| Remote GitHub MCP | Contents: Read (minimum), adjust based on toolsets |

0 commit comments

Comments
 (0)