migrated custom tools to V2 plugin
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import { $ } from "bun"
|
||||
import type { Info } from "@opencode/plugin/promise/tool"
|
||||
|
||||
const teaActionsRunsList: Info = {
|
||||
name: "tea-actions-runs-list",
|
||||
description: "List workflow runs for Gitea actions with optional filters",
|
||||
input: {
|
||||
type: "object",
|
||||
properties: {
|
||||
status: { type: "string", description: "Filter by status (success, failure, pending, queued, in_progress, skipped, canceled)" },
|
||||
branch: { type: "string", description: "Filter by branch name" },
|
||||
event: { type: "string", description: "Filter by event type (push, pull_request, etc.)" },
|
||||
limit: { type: "number", description: "Number of results to return (default: 30)" },
|
||||
since: { type: "string", description: "Show runs started after this time (e.g., '24h', '7d')" },
|
||||
},
|
||||
additionalProperties: false,
|
||||
},
|
||||
async execute(input) {
|
||||
const { status, branch, event, limit, since } = input as {
|
||||
status?: string
|
||||
branch?: string
|
||||
event?: string
|
||||
limit?: number
|
||||
since?: string
|
||||
}
|
||||
let cmd = [`tea`, `actions`, `runs`, `list`, `-o`, `json`]
|
||||
if (status) cmd = [...cmd, `--status`, status]
|
||||
if (branch) cmd = [...cmd, `--branch`, branch]
|
||||
if (event) cmd = [...cmd, `--event`, event]
|
||||
if (limit) cmd = [...cmd, `--limit`, String(limit)]
|
||||
if (since) cmd = [...cmd, `--since`, since]
|
||||
const result = await $`${cmd}`.text()
|
||||
return { content: result.trim() }
|
||||
},
|
||||
}
|
||||
|
||||
export default teaActionsRunsList
|
||||
Reference in New Issue
Block a user