mirror of
https://github.com/anomalyco/opencode.git
synced 2026-02-01 22:48:16 +00:00
ci: auto triage issues
This commit is contained in:
63
.github/workflows/auto-label-tui.yml
vendored
63
.github/workflows/auto-label-tui.yml
vendored
@@ -1,63 +0,0 @@
|
|||||||
name: Auto-label TUI Issues
|
|
||||||
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types: [opened]
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
auto-label:
|
|
||||||
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
issues: write
|
|
||||||
steps:
|
|
||||||
- name: Auto-label and assign issues
|
|
||||||
uses: actions/github-script@v7
|
|
||||||
with:
|
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
script: |
|
|
||||||
const issue = context.payload.issue;
|
|
||||||
const title = issue.title;
|
|
||||||
const description = issue.body || '';
|
|
||||||
|
|
||||||
// Check for "opencode web" keyword
|
|
||||||
const webPattern = /(opencode web)/i;
|
|
||||||
const isWebRelated = webPattern.test(title) || webPattern.test(description);
|
|
||||||
|
|
||||||
// Check for version patterns like v1.0.x or 1.0.x
|
|
||||||
const versionPattern = /[v]?1\.0\./i;
|
|
||||||
const isVersionRelated = versionPattern.test(title) || versionPattern.test(description);
|
|
||||||
|
|
||||||
// Check for "nix" keyword
|
|
||||||
const nixPattern = /\bnix\b/i;
|
|
||||||
const isNixRelated = nixPattern.test(title) || nixPattern.test(description);
|
|
||||||
|
|
||||||
const labels = [];
|
|
||||||
|
|
||||||
if (isWebRelated) {
|
|
||||||
labels.push('web');
|
|
||||||
|
|
||||||
// Assign to adamdotdevin
|
|
||||||
await github.rest.issues.addAssignees({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: issue.number,
|
|
||||||
assignees: ['adamdotdevin']
|
|
||||||
});
|
|
||||||
} else if (isVersionRelated) {
|
|
||||||
// Only add opentui if NOT web-related
|
|
||||||
labels.push('opentui');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isNixRelated) {
|
|
||||||
labels.push('nix');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (labels.length > 0) {
|
|
||||||
await github.rest.issues.addLabels({
|
|
||||||
owner: context.repo.owner,
|
|
||||||
repo: context.repo.repo,
|
|
||||||
issue_number: issue.number,
|
|
||||||
labels: labels
|
|
||||||
});
|
|
||||||
}
|
|
||||||
32
.github/workflows/triage.yml
vendored
Normal file
32
.github/workflows/triage.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
name: Issue Triage
|
||||||
|
|
||||||
|
on:
|
||||||
|
issues:
|
||||||
|
types: [opened]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
triage:
|
||||||
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
issues: write
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
|
- name: Install opencode
|
||||||
|
run: curl -fsSL https://opencode.ai/install | bash
|
||||||
|
|
||||||
|
- name: Triage issue
|
||||||
|
env:
|
||||||
|
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
|
||||||
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||||
|
run: |
|
||||||
|
opencode run --agent triage "The following issue was just opened, triage it:
|
||||||
|
|
||||||
|
Title: ${{ github.event.issue.title }}
|
||||||
|
|
||||||
|
${{ github.event.issue.body }}"
|
||||||
12
.opencode/agent/triage.md
Normal file
12
.opencode/agent/triage.md
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
mode: primary
|
||||||
|
hidden: true
|
||||||
|
model: opencode/claude-haiku-4-5
|
||||||
|
tools:
|
||||||
|
"*": false
|
||||||
|
"github-triage": true
|
||||||
|
---
|
||||||
|
|
||||||
|
You are a triage agent responsible for triaging github issues.
|
||||||
|
|
||||||
|
Use your github-triage tool to triage issues.
|
||||||
4
.opencode/env.d.ts
vendored
Normal file
4
.opencode/env.d.ts
vendored
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
declare module "*.txt" {
|
||||||
|
const content: string
|
||||||
|
export default content
|
||||||
|
}
|
||||||
@@ -11,4 +11,7 @@
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
"mcp": {},
|
"mcp": {},
|
||||||
|
"tools": {
|
||||||
|
"github-triage": false,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
51
.opencode/tool/github-triage.ts
Normal file
51
.opencode/tool/github-triage.ts
Normal file
@@ -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")
|
||||||
|
},
|
||||||
|
})
|
||||||
79
.opencode/tool/github-triage.txt
Normal file
79
.opencode/tool/github-triage.txt
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
Use this tool to assign and/or label a Github issue.
|
||||||
|
|
||||||
|
You can assign the following users:
|
||||||
|
- thdxr
|
||||||
|
- adamdotdevin
|
||||||
|
- fwang
|
||||||
|
- jayair
|
||||||
|
- kommander
|
||||||
|
- rekram1-node
|
||||||
|
|
||||||
|
|
||||||
|
You can use the following labels:
|
||||||
|
- nix
|
||||||
|
- opentui
|
||||||
|
- perf
|
||||||
|
- web
|
||||||
|
- zen
|
||||||
|
- docs
|
||||||
|
|
||||||
|
Always try to assign an issue, if in doubt, assign rekram1-node to it.
|
||||||
|
|
||||||
|
## Breakdown of responsibilities:
|
||||||
|
|
||||||
|
### thdxr
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
This relates to OpenCode server primarily but has overlap with just about anything
|
||||||
|
|
||||||
|
### adamdotdevin
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### fwang
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
|
### jayair
|
||||||
|
|
||||||
|
Jay is responsible for documentation. If there is an issue relating to documentation assign him.
|
||||||
|
|
||||||
|
### kommander
|
||||||
|
|
||||||
|
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:
|
||||||
|
- random characters on screen
|
||||||
|
- keybinds not working on different terminals
|
||||||
|
- general terminal stuff
|
||||||
|
Then assign the issue to Him.
|
||||||
|
|
||||||
|
### rekram1-node
|
||||||
|
|
||||||
|
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.
|
||||||
|
If no one else makes sense to assign, assign rekram1-node to it.
|
||||||
|
|
||||||
|
## Breakdown of Labels:
|
||||||
|
|
||||||
|
### nix
|
||||||
|
|
||||||
|
Any issue that mentions nix, or nixos should have a nix label
|
||||||
|
|
||||||
|
### opentui
|
||||||
|
|
||||||
|
Anything relating to the TUI itself should have an opentui label
|
||||||
|
|
||||||
|
### perf
|
||||||
|
|
||||||
|
Anything related to slow performance, high ram, high cpu usage, or any other performance related issue should have a perf label
|
||||||
|
|
||||||
|
### web
|
||||||
|
|
||||||
|
Anything related to `opencode web` or the desktop app should have a web label
|
||||||
|
|
||||||
|
### zen
|
||||||
|
|
||||||
|
Anything related to OpenCode Zen, billing, or model quality from Zen should have a zen label
|
||||||
|
|
||||||
|
### docs
|
||||||
|
|
||||||
|
Anything related to the documentation should have a docs label
|
||||||
Reference in New Issue
Block a user