Skip to main content
Glama
piyushgIITian

GitHub Enterprise MCP Server

trigger-workflow

Initiate a workflow run in a GitHub repository using specified branch, tag, or commit reference to automate CI/CD processes and deployment tasks.

Instructions

Trigger a workflow run in a GitHub repository

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputsNoWorkflow inputs
ownerYesRepository owner
refYesGit reference (branch, tag, SHA)
repoYesRepository name
workflow_idYesWorkflow ID or file name

Implementation Reference

  • The core handler function that parses arguments using TriggerWorkflowSchema, authenticates with GitHub API, and dispatches the workflow run using actions.createWorkflowDispatch.
    export async function triggerWorkflow(args: unknown): Promise<any> { const { owner, repo, workflow_id, ref, inputs } = TriggerWorkflowSchema.parse(args); const github = getGitHubApi(); return tryCatchAsync(async () => { const { data } = await github.getOctokit().actions.createWorkflowDispatch({ owner, repo, workflow_id, ref, inputs, }); return { success: true, message: `Workflow dispatch event created for workflow ${workflow_id} on ref ${ref}`, data, }; }, 'Failed to trigger workflow'); }
  • Zod schema for validating trigger-workflow inputs, extending OwnerRepoSchema (owner/repo required). Used in the handler for parsing.
    export const TriggerWorkflowSchema = OwnerRepoSchema.extend({ workflow_id: z.union([z.string(), z.number()]), ref: z.string().min(1, 'Git reference is required'), inputs: z.record(z.string()).optional(), });
  • src/server.ts:356-386 (registration)
    Tool registration in the ListToolsRequestSchema handler, defining name, description, and inputSchema for the MCP protocol.
    { name: 'trigger-workflow', description: 'Trigger a workflow run in a GitHub repository', inputSchema: { type: 'object', properties: { owner: { type: 'string', description: 'Repository owner', }, repo: { type: 'string', description: 'Repository name', }, workflow_id: { type: ['string', 'number'], description: 'Workflow ID or file name', }, ref: { type: 'string', description: 'Git reference (branch, tag, SHA)', }, inputs: { type: 'object', description: 'Workflow inputs', }, }, required: ['owner', 'repo', 'workflow_id', 'ref'], additionalProperties: false, }, },
  • Dispatch in the CallToolRequestSchema switch statement that routes calls to the triggerWorkflow handler.
    case 'trigger-workflow': result = await triggerWorkflow(parsedArgs); break;

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/piyushgIITian/github-enterprice-mcp'

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