feat(gitea): add branch and event filters to pipeline discovery

This commit is contained in:
2026-03-04 10:07:41 +01:00
parent ee3d7714c2
commit 616d8a039b

View File

@@ -37,6 +37,8 @@ const LIST_PIPELINES_TOOL: Tool = {
owner: { type: "string", description: "Repository owner (e.g., 'mmintel')" },
repo: { type: "string", description: "Repository name (e.g., 'at-mintel')" },
limit: { type: "number", description: "Number of runs to fetch (default: 5)" },
branch: { type: "string", description: "Optional: Filter by branch name (e.g., 'main')" },
event: { type: "string", description: "Optional: Filter by trigger event (e.g., 'push', 'pull_request')" },
},
required: ["owner", "repo"],
},
@@ -82,12 +84,15 @@ server.setRequestHandler(ListToolsRequestSchema, async () => {
server.setRequestHandler(CallToolRequestSchema, async (request) => {
if (request.params.name === "gitea_list_pipelines") {
// ... (Keeping exact same implementation as before for brevity)
const { owner, repo, limit = 5 } = request.params.arguments as any;
const { owner, repo, limit = 5, branch, event } = request.params.arguments as any;
try {
const apiParams: Record<string, any> = { limit };
if (branch) apiParams.branch = branch;
if (event) apiParams.event = event;
const runsResponse = await giteaClient.get(`/repos/${owner}/${repo}/actions/runs`, {
params: { limit },
params: apiParams,
});
const runs = (runsResponse.data.workflow_runs || []) as any[];