get_workflow_usage
Retrieve detailed usage statistics for GitHub Actions workflows by providing the repository owner, repository name, and workflow ID. Useful for monitoring and optimizing workflow performance.
Instructions
Get usage statistics of a workflow
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| owner | Yes | Repository owner | |
| repo | Yes | Repository name | |
| workflowId | Yes | The ID of the workflow or filename |
Implementation Reference
- src/tools/get-workflow-usage.ts:5-19 (handler)The main ToolHandler function that extracts owner, repo, workflowId from args and calls the GitHub API to retrieve workflow usage statistics, returning the data or throwing a WorkflowError on failure.const handleGetWorkflowUsage: ToolHandler = async (args, octokit: Octokit) => { const { owner, repo, workflowId } = args; try { const response = await octokit.rest.actions.getWorkflowUsage({ owner, repo, workflow_id: workflowId }); return response.data; } catch (error: any) { throw new WorkflowError(`Failed to get workflow usage: ${error.message}`, error.response?.data); } };
- src/tools/tool-definitions.ts:55-73 (schema)The tool metadata definition including name, description, and input schema (owner, repo, workflowId as string or number).{ name: "get_workflow_usage", description: "Get usage statistics of a workflow", inputSchema: { type: "object", properties: { owner: { type: "string", description: "Repository owner" }, repo: { type: "string", description: "Repository name" }, workflowId: { oneOf: [ { type: "string" }, { type: "number" } ], description: "The ID of the workflow or filename" } }, required: ["owner", "repo", "workflowId"] } },
- src/tools/index.ts:18-18 (registration)Maps the tool name 'get_workflow_usage' to its handler function in the toolHandlers export.get_workflow_usage: handleGetWorkflowUsage,
- src/tools/index.ts:6-6 (registration)Imports the handler function from its dedicated file.import handleGetWorkflowUsage from './get-workflow-usage.js';