Skip to content

Commit 1caf3ed

Browse files
Copilotmnkiefer
andcommitted
Clarify ProjectOps PAT requirements for user vs org Projects v2
Co-authored-by: mnkiefer <8320933+mnkiefer@users.noreply.github.com>
1 parent 9368af9 commit 1caf3ed

3 files changed

Lines changed: 78 additions & 7 deletions

File tree

docs/src/content/docs/examples/issue-pr-events/projectops.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,46 @@ By default, `update-project` is update-only: create the Project once in the GitH
1313

1414
**Important**: GitHub Projects v2 requires a PAT or GitHub App token - the default `GITHUB_TOKEN` cannot access Projects v2. Configure [`GH_AW_PROJECT_GITHUB_TOKEN`](/gh-aw/reference/tokens/#gh_aw_project_github_token-github-projects-v2) before using `update-project`.
1515

16+
## Token Requirements for Projects v2
17+
18+
The type of Personal Access Token (PAT) you need depends on whether you're working with **user-owned** or **organization-owned** Projects:
19+
20+
### User-owned Projects (v2)
21+
22+
**Must use a classic PAT** - Fine-grained PATs do **not** work with user-owned Projects.
23+
24+
Required scopes:
25+
- `project` (required for user Projects)
26+
- `repo` (required if accessing private repositories)
27+
28+
Create at: [https://github.com/settings/tokens/new](https://github.com/settings/tokens/new)
29+
30+
### Organization-owned Projects (v2)
31+
32+
**Can use either classic or fine-grained PAT**:
33+
34+
**Option 1: Classic PAT**
35+
- `project` (required)
36+
- `read:org` (required for org Projects)
37+
- `repo` (required if accessing private repositories)
38+
39+
**Option 2: Fine-grained PAT**
40+
- Repository access: Select specific repos or "All repositories"
41+
- **Organization permissions** (must be explicitly granted):
42+
- **Organization access**: Must be granted to the target organization
43+
- **Projects**: Read+Write
44+
- **Important**: Fine-grained PATs work by default only for public org resources. You must explicitly grant organization access and Projects permissions.
45+
46+
Create at: [https://github.com/settings/personal-access-tokens/new](https://github.com/settings/personal-access-tokens/new)
47+
48+
**Setup**: After creating your PAT, add it to your repository:
49+
50+
```bash
51+
gh aw secrets set GH_AW_PROJECT_GITHUB_TOKEN --value "YOUR_PROJECT_PAT"
52+
```
53+
54+
See the [GitHub Projects v2 token reference](/gh-aw/reference/tokens/#gh_aw_project_github_token-github-projects-v2) for complete details.
55+
1656
## When to Use ProjectOps
1757

1858
ProjectOps complements [GitHub's built-in Projects automation](https://docs.github.com/en/issues/planning-and-tracking-with-projects/automating-your-project/using-the-built-in-automations) with AI-powered intelligence:

docs/src/content/docs/reference/safe-outputs.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,11 @@ safe-outputs:
360360

361361
Agent output **must include a full GitHub project URL** in the `project` field (e.g., `https://github.com/orgs/myorg/projects/42` or `https://github.com/users/username/projects/5`). Project names or numbers alone are not accepted. Can also supply `content_number`, `content_type`, `fields`, and `campaign_id`. The job adds the issue or PR to the board, updates custom fields, applies `campaign:<id>` labels, and exposes `project-id`, `project-number`, `project-url`, `campaign-id`, and `item-id` outputs. Cross-repository targeting not supported.
362362

363-
To opt in to creating missing project boards, include `create_if_missing: true` in the `update_project` output. Your token must have sufficient permissions to create projects in the organization (classic PAT with `project` + `repo` scopes, or fine-grained PAT with Projects: Read+Write, or GitHub App with Projects permissions).
363+
To opt in to creating missing project boards, include `create_if_missing: true` in the `update_project` output. Your token must have sufficient permissions:
364+
- **User-owned Projects**: Classic PAT with `project` + `repo` scopes (fine-grained PATs don't work)
365+
- **Organization-owned Projects**: Classic PAT with `project` + `read:org` scopes, or fine-grained PAT with explicit Organization access and Projects: Read+Write, or GitHub App with Projects permissions
366+
367+
See [GitHub Projects v2 token requirements](/gh-aw/reference/tokens/#gh_aw_project_github_token-github-projects-v2) for detailed setup instructions.
364368

365369
### Pull Request Creation (`create-pull-request:`)
366370

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

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -197,13 +197,35 @@ A specialized token for GitHub Projects v2 operations used by the [`update-proje
197197

198198
**Setup**:
199199

200-
1. Create a **classic PAT** with `project` and `repo` scopes, **OR** a [fine-grained PAT](https://github.com/settings/personal-access-tokens/new) with:
200+
The required token type depends on whether you're working with **user-owned** or **organization-owned** Projects:
201+
202+
**For User-owned Projects (v2)**:
203+
204+
You **must** use a **classic PAT** with the `project` scope. Fine-grained PATs do **not** work with user-owned Projects.
205+
206+
1. Create a [classic PAT](https://github.com/settings/tokens/new) with scopes:
207+
- `project` (required for user Projects)
208+
- `repo` (required if accessing private repositories)
209+
210+
**For Organization-owned Projects (v2)**:
211+
212+
You can use either a classic PAT or a fine-grained PAT:
213+
214+
1. **Option A**: Create a **classic PAT** with `project` and `read:org` scopes:
215+
- `project` (required)
216+
- `read:org` (required for org Projects)
217+
- `repo` (required if accessing private repositories)
218+
219+
2. **Option B**: Create a [fine-grained PAT](https://github.com/settings/personal-access-tokens/new) with:
201220
- Repository access: Select specific repos or "All repositories"
202-
- Organization permissions:
203-
- Projects: Read+Write (for creating and managing org Projects)
204-
- **OR** use a GitHub App with Projects: Read+Write permission
221+
- **Organization permissions** (must be explicitly granted):
222+
- **Organization access**: Must be granted to the target organization
223+
- **Projects**: Read+Write (for creating and managing org Projects)
224+
- **Important**: Fine-grained PATs work by default only for public org resources. You must explicitly grant organization access and Projects permissions.
205225

206-
2. Add to repository secrets:
226+
3. **Option C**: Use a GitHub App with Projects: Read+Write permission
227+
228+
After creating your token, add it to repository secrets:
207229

208230
```bash wrap
209231
gh aw secrets set GH_AW_PROJECT_GITHUB_TOKEN --value "YOUR_PROJECT_PAT"
@@ -235,7 +257,12 @@ safe-outputs:
235257
:::note[Default behavior]
236258
By default, `update-project` is **update-only**: it will not create projects. If a project doesn't exist, the job fails with instructions to create it manually.
237259

238-
**Important**: The default `GITHUB_TOKEN` **cannot** be used for Projects v2 operations. You **must** configure `GH_AW_PROJECT_GITHUB_TOKEN` or provide a custom token via `safe-outputs.update-project.github-token`. GitHub Projects v2 requires GraphQL API access with a PAT (classic with `project` + `repo` scopes, or fine-grained with Projects permissions) or a GitHub App.
260+
**Important**: The default `GITHUB_TOKEN` **cannot** be used for Projects v2 operations. You **must** configure `GH_AW_PROJECT_GITHUB_TOKEN` or provide a custom token via `safe-outputs.update-project.github-token`.
261+
262+
**GitHub Projects v2 PAT Requirements**:
263+
- **User-owned Projects**: Require a **classic PAT** with the `project` scope (plus `repo` if accessing private repos). Fine-grained PATs do **not** work with user-owned Projects.
264+
- **Organization-owned Projects**: Can use either a classic PAT with `project` + `read:org` scopes, **or** a fine-grained PAT with explicit Organization access granted plus Projects: Read+Write permission. Fine-grained PATs work by default only for public org resources and must be explicitly granted organization access.
265+
- **GitHub App**: Works for both user and org Projects with Projects: Read+Write permission.
239266

240267
To opt-in to creating projects, the agent must include `create_if_missing: true` in its output, and the token must have sufficient permissions to create projects in the organization.
241268
:::

0 commit comments

Comments
 (0)