Skip to main content

github.create_pr

github.create_pr opens a pull request via the GitHub REST API using a vault-stored PAT. It is the final step of swe.solve's pull_request output mode: repo.push lands the agent's work on a new branch, then this pack opens the PR for a human to review. As with every github.* pack, the token is resolved from the vault by name and never travels through the pack input or the agent-visible surface.

Inputs

FieldTypeRequiredDefaultNotes
repostringyesowner/name.
headstringyesSource branch.
basestringyesTarget branch (e.g. main).
titlestringyesPR title.
bodystringnoPR description (markdown).
draftbooleannofalseOpen as a draft PR.
credentialstringnogithub-tokenVault entry name.

Outputs

FieldTypeNotes
numbernumberPR number.
urlstringAPI URL.
html_urlstringWeb URL for review.

Vault credentials needed

  • github-token — type api_key, scoped to api.github.com. Required (PR creation is a write).

Use it from your agent (OpenClaw chat-UI worked example)

OpenClaw chat capture pending.

Developer reference (curl)

curl -fsS -X POST http://localhost:3000/api/v1/packs/github.create_pr \
-H "Authorization: Bearer $JWT" \
-H 'Content-Type: application/json' \
-d '{
"repo": "tosin2013/helmdeck",
"head": "fix-typo",
"base": "main",
"title": "docs: fix typo"
}'

Error codes

CodeTriggers
invalid_inputrepo/head/base/title missing.
handler_failedGitHub REST error (auth, branch not found, PR already exists).

Session chaining

  • No session. Typically the last step after a session-scoped swe.solve / repo.push.

Async behavior

Synchronous only.

See also