Skip to content
Proud to collaborate with Microsoft for Startups

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 ​

PropertyValue
Workflow typeAtomic
LibraryApp-github
Version1.0

Input Schema ​

FieldTypeRequiredDefaultDescription
ownerstringYes—Repository owner
repostringYes—Repository name
pathstringYes—File path relative to repo root
refstringNo—Branch, tag, or commit SHA
missing_okbooleanNoTrueReturn default_content instead of failing when the file is absent; defaults to true
default_contentstringNo—Content returned when missing_ok handles a missing file
organization_uuiduuidNo—Optional organization context

Output Schema ​

FieldTypeRequiredDefaultDescription
contentstringNo——
file_urlstringNo——
shastringNo——
sizeintegerNo——
existsbooleanNo——
default_contentstringNo——
missing_okbooleanNo——
ownerstringNo——
pathstringNo——
refstringNo——
repostringNo——
organization_uuiduuidNo——
failure_reasonstringNo——
failure_typestringNo——
failed_actionstringNo——
failed_at_statestringNo——
failed_stepstringNo——
failed_layerstringNo——
errorstringNo——
error_typestringNo——

States ​

StateInitialTerminalSuccessAuto-advanceDescription
pendingYesNo—execute—
completedNoYesYes——
failedNoYesNo——

State Diagram ​

Transitions ​

FromActionToDescription
pendingexecutecompleted—
* (any state)failfailed—

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"
  }
}