Skip to content

Commit bfb254d

Browse files
committed
ci: auto triage issues
1 parent 92fe927 commit bfb254d

File tree

7 files changed

+181
-63
lines changed

7 files changed

+181
-63
lines changed

.github/workflows/auto-label-tui.yml

Lines changed: 0 additions & 63 deletions
This file was deleted.

.github/workflows/triage.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Issue Triage
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
triage:
9+
runs-on: blacksmith-4vcpu-ubuntu-2404
10+
permissions:
11+
contents: read
12+
issues: write
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 1
18+
19+
- name: Install opencode
20+
run: curl -fsSL https://opencode.ai/install | bash
21+
22+
- name: Triage issue
23+
env:
24+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
25+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
ISSUE_NUMBER: ${{ github.event.issue.number }}
27+
run: |
28+
opencode run --agent triage "The following issue was just opened, triage it:
29+
30+
Title: ${{ github.event.issue.title }}
31+
32+
${{ github.event.issue.body }}"

.opencode/agent/triage.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
mode: primary
3+
hidden: true
4+
model: opencode/claude-haiku-4-5
5+
tools:
6+
"*": false
7+
"github-triage": true
8+
---
9+
10+
You are a triage agent responsible for triaging github issues.
11+
12+
Use your github-triage tool to triage issues.

.opencode/env.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
declare module "*.txt" {
2+
const content: string
3+
export default content
4+
}

.opencode/opencode.jsonc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,7 @@
1111
},
1212
},
1313
"mcp": {},
14+
"tools": {
15+
"github-triage": false,
16+
},
1417
}

.opencode/tool/github-triage.ts

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
import { Octokit } from "@octokit/rest"
2+
import { tool } from "@opencode-ai/plugin"
3+
import DESCRIPTION from "./github-triage.txt"
4+
5+
function getIssueNumber(): number {
6+
const issue = parseInt(process.env.ISSUE_NUMBER ?? "", 10)
7+
if (!issue) throw new Error("ISSUE_NUMBER env var not set")
8+
return issue
9+
}
10+
11+
export default tool({
12+
description: DESCRIPTION,
13+
args: {
14+
assignee: tool.schema
15+
.enum(["thdxr", "adamdotdevin", "rekram1-node", "fwang", "jayair", "kommander"])
16+
.describe("The username of the assignee")
17+
.default("rekram1-node"),
18+
labels: tool.schema
19+
.array(tool.schema.enum(["nix", "opentui", "perf", "web", "zen", "docs"]))
20+
.describe("The labels(s) to add to the issue")
21+
.optional(),
22+
},
23+
async execute(args) {
24+
const issue = getIssueNumber()
25+
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN })
26+
const owner = "sst"
27+
const repo = "opencode"
28+
29+
const results: string[] = []
30+
31+
await octokit.rest.issues.addAssignees({
32+
owner,
33+
repo,
34+
issue_number: issue,
35+
assignees: [args.assignee],
36+
})
37+
results.push(`Assigned @${args.assignee} to issue #${issue}`)
38+
39+
if (args.labels && args.labels.length > 0) {
40+
await octokit.rest.issues.addLabels({
41+
owner,
42+
repo,
43+
issue_number: issue,
44+
labels: args.labels,
45+
})
46+
results.push(`Added labels: ${args.labels.join(", ")}`)
47+
}
48+
49+
return results.join("\n")
50+
},
51+
})

.opencode/tool/github-triage.txt

Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
Use this tool to assign and/or label a Github issue.
2+
3+
You can assign the following users:
4+
- thdxr
5+
- adamdotdevin
6+
- fwang
7+
- jayair
8+
- kommander
9+
- rekram1-node
10+
11+
12+
You can use the following labels:
13+
- nix
14+
- opentui
15+
- perf
16+
- web
17+
- zen
18+
- docs
19+
20+
Always try to assign an issue, if in doubt, assign rekram1-node to it.
21+
22+
## Breakdown of responsibilities:
23+
24+
### thdxr
25+
26+
Dax is responsible for managing core parts of the application, for large feature requests, api changes, or things that require significant changes to the codebase assign him.
27+
28+
This relates to OpenCode server primarily but has overlap with just about anything
29+
30+
### adamdotdevin
31+
32+
Adam is responsible for managing the Desktop/Web app. If there is an issue relating to the desktop app or `opencode web` command. Assign him.
33+
34+
### fwang
35+
36+
Frank is responsible for managing Zen, if you see complaints about OpenCode Zen, maybe it's the dashboard, the model quality, billing issues, etc. Assign him to the issue.
37+
38+
### jayair
39+
40+
Jay is responsible for documentation. If there is an issue relating to documentation assign him.
41+
42+
### kommander
43+
44+
Sebastian is responsible for managing an OpenTUI (a library for building terminal user interfaces). OpenCode's TUI is built with OpenTUI. If there are issues abou:
45+
- random characters on screen
46+
- keybinds not working on different terminals
47+
- general terminal stuff
48+
Then assign the issue to Him.
49+
50+
### rekram1-node
51+
52+
Assign Aiden to an issue as a catch all, if you can't assign anyone else. Most of the time this will be bugs/polish things.
53+
If no one else makes sense to assign, assign rekram1-node to it.
54+
55+
## Breakdown of Labels:
56+
57+
### nix
58+
59+
Any issue that mentions nix, or nixos should have a nix label
60+
61+
### opentui
62+
63+
Anything relating to the TUI itself should have an opentui label
64+
65+
### perf
66+
67+
Anything related to slow performance, high ram, high cpu usage, or any other performance related issue should have a perf label
68+
69+
### web
70+
71+
Anything related to `opencode web` or the desktop app should have a web label
72+
73+
### zen
74+
75+
Anything related to OpenCode Zen, billing, or model quality from Zen should have a zen label
76+
77+
### docs
78+
79+
Anything related to the documentation should have a docs label

0 commit comments

Comments
 (0)