Actions
Get a workflow
One workflow, named by its id, its file name (ci.yml), its path or its name (CI): what list_workflows says of it, with source, its file as written on ref (the default branch unless you give a branch or tag), and ref, the branch or tag read.
GET
/repos/{owner}/{name}/actions/workflows/{workflow}workflow is the workflow’s id, file name, path or name. source is its file as written on ref; 404 when the file is not on that branch or tag.
- Authentication: Required. Send an access token as
Authorization: Bearer. - MCP tool:
workflowwithactionget, and the same inputs - Scope: An access token needs
workflows:read.
Path parameters
Section titled “Path parameters”| Name | Type | Required | Description |
|---|---|---|---|
owner |
string | Yes | The workspace that owns the repository. |
name |
string | Yes | The repository’s name. |
workflow |
string | Yes | The workflow’s id, file name (ci.yml), path or name. |
Query parameters
Section titled “Query parameters”| Name | Type | Required | Description |
|---|---|---|---|
ref |
string | No | A branch or tag to read its file on. The default branch if not given. |
Example request
Section titled “Example request”curl "https://api.g1t.sh/repos/flagon-io/hello/actions/workflows/release.yml?ref=main" \ -H "Authorization: Bearer $G1T_TOKEN"Example response
Section titled “Example response”A successful request answers 200 with:
{ "id": "wfl_01kpw2c5d8e1f4g7h0j3k6m9nr", "path": ".g1t/workflows/release.yml", "name": "Release", "events": [ "workflow_dispatch" ], "state": "active", "error": null, "notes": [], "dispatch": { "channel": { "type": "choice", "options": [ "beta", "stable" ], "default": "beta" } }, "last_run": null, "ref": "main", "source": "name: Release\non:\n workflow_dispatch:\n inputs:\n channel:\n type: choice\n options: [beta, stable]\n default: beta\njobs:\n release:\n runs-on: ubuntu-latest\n steps:\n - uses: actions/checkout@v4\n - run: ./scripts/release.sh ${{ inputs.channel }}\n"}Errors
Section titled “Errors”A failed request answers with one of these statuses and a body like {"error": {"code": "not_found", "message": "Repository not found."}}. See errors.
| Status | Code | When |
|---|---|---|
| 401 | unauthenticated |
A token is required, or the one sent is not valid. |
| 403 | forbidden |
The token is valid but not allowed to do this, such as a member-only change, or a token without the scope it needs. |
| 404 | not_found |
It does not exist, or you cannot see it. |
| 422 | invalid |
The input is not valid. message says which field and why. |