# Run Workflow — GitHub

> Trigger a GitHub Actions workflow run, or re-run the failed jobs of a previous run. To start a new run, provide workflow (the workflow file name, e.g. ci.yml, its display name, or its numeric ID) and optionally ref (the branch or tag to…

- Key: `github-run-workflow`
- Type: Action (Write)
- Version: 0.0.3
- App: GitHub (`github`) — https://pipedream.com/apps/github.md
- This page (HTML): https://pipedream.com/apps/github/actions/run-workflow
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/github/actions/run-workflow/run-workflow.mjs

## Description

Trigger a GitHub Actions workflow run, or re-run the failed jobs of a previous run. To start a new run, provide `workflow` (the workflow file name, e.g. `ci.yml`, its display name, or its numeric ID) and optionally `ref` (the branch or tag to run on — defaults to the repository's default branch) and `inputs` (for `workflow_dispatch` workflows). To re-run only the failed jobs of an existing run instead, provide `rerunFailedRunId`. The workflow must already have a `workflow_dispatch` trigger to be dispatchable. Use **List Workflows** to find the workflow file name and **List Workflow Runs** to find a run ID. Provide the repository as an `owner/repo` string. [See the documentation](https://docs.github.com/en/rest/actions/workflows#create-a-workflow-dispatch-event)

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `repoFullname` | `string` | Yes | The repository in owner/repo format, for example PipedreamHQ/pipedream (not case sensitive). If you pass just a repository name with no owner (e.g. my-repo), the authenticated user is assumed as the owner — convenient for "my repo" requests. Do NOT repeat the repository name as the owner (e.g. my-repo/my-repo); if you don't know the owner, pass only the name or run List Repositories to find it. |
| `workflow` | `string` | No | The workflow to dispatch — its file name (e.g. ci.yml), display name, or numeric ID. Required unless re-running failed jobs. Use List Workflows to discover available workflows. |
| `ref` | `string` | No | The branch or tag to run the workflow on, e.g. main. Defaults to the repository's default branch. |
| `inputs` | `object` | No | Input keys and values configured in the workflow's workflow_dispatch definition (max 10). Defaults from the workflow file are used for omitted inputs. |
| `rerunFailedRunId` | `string` | No | Provide a workflow run ID here to re-run only its failed jobs instead of dispatching a new run. Use List Workflow Runs to find a run ID. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "github",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "github-run-workflow",
  arguments: {
    repoFullname: "Repository",
    workflow: "Workflow",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "github-run-workflow",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    github: { authProvisionId: "apn_xxxxxxx" },
    repoFullname: "Repository",
    workflow: "Workflow",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "github-run-workflow",
    "configured_props": {
      "github": { "authProvisionId": "apn_xxxxxxx" },
      "repoFullname": "Repository",
      "workflow": "Workflow"
    }
  }'
```

---

- App: https://pipedream.com/apps/github.md · All apps: https://pipedream.com/apps
