{ "$schema": "https://ui.shadcn.com/schema/registry-item.json", "name": "github-create-issue", "type": "registry:item", "description": "Create an issue on GitHub", "dependencies": [], "files": [ { "path": "steps/github-create-issue.ts", "content": "/**\n * Create an issue on GitHub\n *\n * @param owner - Repository owner (username or organization)\n * @param repo - Repository name\n * @param title - Issue title\n * @param body - Issue body content (supports Markdown)\n * @param labels - Optional array of label names\n * @returns The created issue with URL and number\n *\n * @env GITHUB_TOKEN - GitHub personal access token\n */\n\nimport { FatalError } from \"workflow\"\n\ninterface CreateIssueOptions {\n owner: string\n repo: string\n title: string\n body?: string\n labels?: string[]\n}\n\nexport async function githubCreateIssue({ owner, repo, title, body, labels }: CreateIssueOptions) {\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) {\n throw new FatalError(\"owner, repo, and title are required\")\n }\n\n const url = `https://api.github.com/repos/${owner}/${repo}/issues`\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 body,\n labels,\n }),\n })\n\n if (!response.ok) {\n const error = await response.text()\n throw new Error(`Failed to create GitHub issue: ${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-issue.ts" } ] }