Skip to main content
Glama
onemarc

GitHub Actions MCP Server

by onemarc

trigger_workflow

Trigger a specific GitHub Actions workflow by specifying the repository, workflow ID, and reference. Input parameters can be customized to control workflow execution.

Instructions

Trigger a workflow run

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputsNoInput parameters for the workflow
ownerYesRepository owner
refYesThe reference to run the workflow on (branch, tag, or SHA)
repoYesRepository name
workflowIdYesThe ID of the workflow, filename, or display name as defined in the workflow file's 'name:' field

Implementation Reference

  • The main ToolHandler function implementing the trigger_workflow tool. It resolves the workflow ID by name if it's a string matching a workflow name, lists workflows if necessary, and dispatches the workflow using Octokit's createWorkflowDispatch.
    const handleTriggerWorkflow: ToolHandler = async (args, octokit: Octokit) => { const { owner, repo, workflowId, ref, inputs } = args; try { let workflow_id = workflowId; if (typeof workflowId === 'string' && (workflowId.includes(' ') || /^[A-Z]/.test(workflowId))) { const workflows = await octokit.rest.actions.listRepoWorkflows({ owner, repo }); // Find the workflow by name const matchedWorkflow = workflows.data.workflows.find(w => w.name.toLowerCase() === workflowId.toLowerCase() || w.name === workflowId ); if (matchedWorkflow) { workflow_id = matchedWorkflow.id; } else { throw new WorkflowError(`Workflow with name "${workflowId}" not found. Make sure the name matches exactly as defined in the workflow file.`); } } const response = await octokit.rest.actions.createWorkflowDispatch({ owner, repo, workflow_id, ref, inputs }); return { success: true, message: "Workflow triggered successfully", status: response.status }; } catch (error: any) { throw new WorkflowError(`Failed to trigger workflow: ${error.message}`, error.response?.data); } };
  • The input schema definition for the trigger_workflow tool, specifying parameters like owner, repo, workflowId (string or number, supports name resolution), ref, and optional inputs.
    { name: "trigger_workflow", description: "Trigger a workflow run", 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, filename, or display name as defined in the workflow file's 'name:' field" }, ref: { type: "string", description: "The reference to run the workflow on (branch, tag, or SHA)" }, inputs: { type: "object", description: "Input parameters for the workflow" } }, required: ["owner", "repo", "workflowId", "ref"] } },
  • Registration of all tool handlers in the toolHandlers map, including trigger_workflow mapped to its handler function.
    export const toolHandlers: Record<string, ToolHandler> = { create_workflow: handleCreateWorkflow, list_workflows: handleListWorkflows, get_workflow: handleGetWorkflow, get_workflow_usage: handleGetWorkflowUsage, list_workflow_runs: handleListWorkflowRuns, get_workflow_run: handleGetWorkflowRun, get_workflow_run_jobs: handleGetWorkflowRunJobs, trigger_workflow: handleTriggerWorkflow, cancel_workflow_run: handleCancelWorkflowRun, rerun_workflow: handleRerunWorkflow, };

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/onemarc/github-actions-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server