{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "github-create-pr", "type": "registry:item", "description": "Create a pull request on GitHub", "dependencies": [], "files": [ { "path": "steps/github-create-pr.ts", "content": "/**\n * Create a pull request on GitHub\n *\n * @param owner - Repository owner (username or organization)\n * @param repo - Repository name\n * @param title - PR title\n * @param head - The branch containing changes\n * @param base - The branch to merge into\n * @param body - Optional PR description (supports Markdown)\n * @returns The created PR with URL and number\n *\n * @env GITHUB_TOKEN - GitHub personal access token\n */\n\nimport { FatalError } from \"workflow\"\n\ninterface CreatePROptions {\n owner: string\n repo: string\n title: string\n head: string\n base: string\n body?: string\n}\n\nexport async function githubCreatePR({ owner, repo, title, head, base, body }: CreatePROptions) {\n \"use step\"\n\n const token = process.env.GITHUB_TOKEN\n if (!token) {\n throw new FatalError(\"GITHUB_TOKEN environment variable is required\")\n }\n\n if (!owner || !repo || !title || !head || !base) {\n throw new FatalError(\"owner, repo, title, head, and base are required\")\n }\n\n const url = `https://api.github.com/repos/${owner}/${repo}/pulls`\n\n const response = await fetch(url, {\n method: \"POST\",\n headers: {\n Authorization: `Bearer ${token}`,\n Accept: \"application/vnd.github+json\",\n \"Content-Type\": \"application/json\",\n },\n body: JSON.stringify({\n title,\n head,\n base,\n body,\n }),\n })\n\n if (!response.ok) {\n const error = await response.text()\n throw new Error(`Failed to create GitHub PR: ${error}`)\n }\n\n const data = await response.json()\n return {\n number: data.number,\n url: data.html_url,\n id: data.id,\n state: data.state,\n }\n}\n", "type": "registry:file", "target": "steps/github-create-pr.ts" } ] }