Skip to main content
github.getRepositoryContent reads a file, directory, symlink, or submodule through GitHub’s Contents API. File results include GitHub’s encoded content so your automation can use the bytes instead of only inspecting metadata.
automations/read-github-file.automation.ts
Provide owner, repository, and a repository-relative path; use "" for the root directory. Optional ref accepts a branch, tag, or commit SHA and defaults to the default branch. The result depends on type:
  • A file returns { type: "file", path, sha, content, encoding }. GitHub normally returns Base64 content.
  • A symlink returns { type: "symlink", path, sha, target }.
  • A submodule returns { type: "submodule", path, sha, submodule_git_url }.
  • A directory returns an array of { type, path, sha } entries.
Requires Contents read permission.