github.code.get_file ​
Get the decoded contents of a file from a GitHub repository
Retrieve the decoded contents of a file from a GitHub repository.
Returns the UTF-8 decoded file content along with the blob SHA needed to update the file later (pass sha to github.code.update_file).
Inputs:
- owner: Repository owner (required).
- repo: Repository name (required).
- path: File path relative to the repo root, e.g. src/main.py (required).
- ref: Branch, tag, or commit SHA (optional, default: repo default branch).
- missing_ok: If true (default), return default_content instead of failing on 404.
- default_content: Content to return when missing_ok handles a 404.
Outputs (terminal state_data):
- content: str — decoded file content (UTF-8)
- sha: str — blob SHA, required for subsequent update_file calls
- size: int — file size in bytes
- file_url: str — HTML URL of the file
- exists: bool — true when the file exists at the requested ref
Plugin required: context.get_plugin("github") must expose .token.
Overview ​
| Property | Value |
|---|---|
| Workflow type | Atomic |
| Library | App-github |
| Version | 1.0 |
Input Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
owner | string | Yes | — | Repository owner |
repo | string | Yes | — | Repository name |
path | string | Yes | — | File path relative to repo root |
ref | string | No | — | Branch, tag, or commit SHA |
missing_ok | boolean | No | True | Return default_content instead of failing when the file is absent; defaults to true |
default_content | string | No | — | Content returned when missing_ok handles a missing file |
organization_uuid | uuid | No | — | Optional organization context |
Output Schema ​
| Field | Type | Required | Default | Description |
|---|---|---|---|---|
content | string | No | — | — |
file_url | string | No | — | — |
sha | string | No | — | — |
size | integer | No | — | — |
exists | boolean | No | — | — |
default_content | string | No | — | — |
missing_ok | boolean | No | — | — |
owner | string | No | — | — |
path | string | No | — | — |
ref | string | No | — | — |
repo | string | No | — | — |
organization_uuid | uuid | No | — | — |
failure_reason | string | No | — | — |
failure_type | string | No | — | — |
failed_action | string | No | — | — |
failed_at_state | string | No | — | — |
failed_step | string | No | — | — |
failed_layer | string | No | — | — |
error | string | No | — | — |
error_type | string | No | — | — |
States ​
| State | Initial | Terminal | Success | Auto-advance | Description |
|---|---|---|---|---|---|
pending | Yes | No | — | execute | — |
completed | No | Yes | Yes | — | — |
failed | No | Yes | No | — | — |
State Diagram ​
Transitions ​
| From | Action | To | Description |
|---|---|---|---|
pending | execute | completed | — |
* (any state) | fail | failed | — |
API Usage ​
bash
POST /api/workflows/start
Content-Type: application/json
{
"workflow_type": "github.code.get_file",
"initial_data": {
"owner": "value",
"repo": "value",
"path": "value"
}
}