Put a PR on a Projects v2 board with add_pull_request_to_project
Add a pull request itself (not the issue it closes) as an item on a Projects v2 board.
Prerequisites
Section titled “Prerequisites”github-pull-requestsinstalled (this call reusesgithub-sdlc-planning’s project-resolution logic).- The project board’s owner login and project number.
- A classic token needs the
projectOAuth scope (gh auth login --scopes project); the call asserts this scope before doing anything else.
-
Identify
projectOwnerLogin(the org or user that owns the board) andprojectNumber. -
Call
add_pull_request_to_project:{"owner": "your-org","repo": "your-repo","pullNumber": 12,"projectOwnerLogin": "your-org","projectNumber": 1,"projectOwnerType": "organization"}projectOwnerTypedefaults toorganizationif omitted. -
Read the response:
{ itemId: string }.
Verify it worked
Section titled “Verify it worked”Open the project board and confirm the PR appears as an item, or note the
returned itemId for a later set_field_value call (from
github-sdlc-planning) against that item.
- This call has no built-in idempotency check: calling it again for a PR already on the board can add a duplicate item. Check the board first if re-adding the same PR is a real possibility.
- A missing
projectscope fails withmissing_scope, not a generic API error — this is checked up front, before any GraphQL call runs. - If project resolution itself fails (bad owner login or project number),
the call fails with
resolve_id_failed.