auto-labeling

This commit is contained in:
David Blass
2025-12-09 17:02:57 -05:00
parent 7ffd7297c3
commit 305fc9b0dd
7 changed files with 137 additions and 87 deletions
+27
View File
@@ -0,0 +1,27 @@
import { type } from "arktype";
import { contextualize, tool } from "./shared.ts";
export const AddLabelsParams = type({
issue_number: type.number.describe("the issue or PR number to add labels to"),
labels: type.string.array().atLeastLength(1).describe("array of label names to add"),
});
export const AddLabelsTool = tool({
name: "add_labels",
description:
"Add labels to a GitHub issue or pull request. Only use labels that already exist in the repository.",
parameters: AddLabelsParams,
execute: contextualize(async ({ issue_number, labels }, ctx) => {
const result = await ctx.octokit.rest.issues.addLabels({
owner: ctx.owner,
repo: ctx.name,
issue_number,
labels,
});
return {
success: true,
labels: result.data.map((label) => label.name),
};
}),
});