diff options
| author | Aiden Cline <[email protected]> | 2025-12-15 19:15:40 -0600 |
|---|---|---|
| committer | Aiden Cline <[email protected]> | 2025-12-15 19:15:40 -0600 |
| commit | bfb254dac6f8a3ea217f5393a33d87c030b12b6d (patch) | |
| tree | 4ed598d3015439d5761ab0f6c0ae56092f97823d /.opencode/tool/github-triage.ts | |
| parent | 92fe9277859afa2d0bd2c47282bc4c248f017aa2 (diff) | |
| download | opencode-bfb254dac6f8a3ea217f5393a33d87c030b12b6d.tar.gz opencode-bfb254dac6f8a3ea217f5393a33d87c030b12b6d.zip | |
ci: auto triage issues
Diffstat (limited to '.opencode/tool/github-triage.ts')
| -rw-r--r-- | .opencode/tool/github-triage.ts | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/.opencode/tool/github-triage.ts b/.opencode/tool/github-triage.ts new file mode 100644 index 000000000..f0437e623 --- /dev/null +++ b/.opencode/tool/github-triage.ts @@ -0,0 +1,51 @@ +import { Octokit } from "@octokit/rest" +import { tool } from "@opencode-ai/plugin" +import DESCRIPTION from "./github-triage.txt" + +function getIssueNumber(): number { + const issue = parseInt(process.env.ISSUE_NUMBER ?? "", 10) + if (!issue) throw new Error("ISSUE_NUMBER env var not set") + return issue +} + +export default tool({ + description: DESCRIPTION, + args: { + assignee: tool.schema + .enum(["thdxr", "adamdotdevin", "rekram1-node", "fwang", "jayair", "kommander"]) + .describe("The username of the assignee") + .default("rekram1-node"), + labels: tool.schema + .array(tool.schema.enum(["nix", "opentui", "perf", "web", "zen", "docs"])) + .describe("The labels(s) to add to the issue") + .optional(), + }, + async execute(args) { + const issue = getIssueNumber() + const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN }) + const owner = "sst" + const repo = "opencode" + + const results: string[] = [] + + await octokit.rest.issues.addAssignees({ + owner, + repo, + issue_number: issue, + assignees: [args.assignee], + }) + results.push(`Assigned @${args.assignee} to issue #${issue}`) + + if (args.labels && args.labels.length > 0) { + await octokit.rest.issues.addLabels({ + owner, + repo, + issue_number: issue, + labels: args.labels, + }) + results.push(`Added labels: ${args.labels.join(", ")}`) + } + + return results.join("\n") + }, +}) |
