Get File
github.get_file
ActionBusiness appsconnection required
Calls the GitHub API GET /repos/{owner}/{repo}/contents/{path}.
Read a file's contents, or list a directory, from a repository.
Connection
- Required
- Yes — the node will not save without one
- Auth type
- Bearer token
- Providers
- GitHub
- Secret shape
- the GitHub personal access token
- Resolved by
- config.connection_id, else node.connection_id, else the tenant's sole GitHub connection
Configuration
4 fields, 3 required. A dotted path is a nested object and name[] an array of objects — the editor renders the same tree.
| Field | Type | Required | Default | Constraints | Example |
|---|---|---|---|---|---|
owner Repository owner — the user or organisation login. Supports {{ }}. | string | Yes | — | — | octocat |
repo Repository name, without the owner prefix. Supports {{ }}. | string | Yes | — | — | hello-world |
path Path of the file inside the repository, e.g. docs/README.md. | string | Yes | — | — | docs/README.md |
ref Branch, tag or commit SHA to read from. Empty uses the default branch. | string | No | — | — | main |
Example configuration
Every value below is the contract’s own example or default — nothing invented.
{
"owner": "octocat",
"path": "docs/README.md",
"ref": "main",
"repo": "hello-world"
}Output
One shape.
result
| Field | Type | Example |
|---|---|---|
ok True when GitHub accepted the call. | boolean | true |
type 'file' or 'dir'. | string | — |
path Path that was read. | string | — |
name File name. | string | — |
sha Blob SHA — pass it to update_file or delete_file. | string | — |
size File size in bytes. | number | — |
encoding How GitHub encoded the blob, normally base64. | string | — |
content The decoded file text; empty for a directory. | string | — |
html_url Link to the file on GitHub. | string | — |
download_url Raw download URL. | string | — |
entries Directory listing when the path is a directory. | array | — |
entries[].name Entry name. | string | — |
entries[].path Entry path. | string | — |
entries[].type 'file' or 'dir'. | string | — |
entries[].size Entry size in bytes. | number | — |
entries[].sha Entry blob SHA. | string | — |
count How many directory entries came back. | number | — |
{
"content": "",
"count": 0,
"download_url": "",
"encoding": "",
"entries": [
{
"name": "",
"path": "",
"sha": "",
"size": 0,
"type": ""
}
],
"html_url": "",
"name": "",
"ok": true,
"path": "",
"sha": "",
"size": 0,
"type": ""
}Notes
- GitHub serves contents up to 1MB this way; a larger file comes back with an empty body, so use github.download_archive for those.
Solutions with GitHub
See Get File run in a workflow.
In a technical demo we add the GitHub connection, drop the node on the canvas and let Workflow Health pre-flight it before the first real run.