Skip to main content

Get file contents

Read a file from a repository as text, or save it to a local file.

Command in the GitHub toolkit · id ooa.github/get_file · 7 inputs (4 required), 3 outputs

Inputs​

InputTypeRequiredDefaultWhat it is
Endpoint addressStringNohttps://api.github.comAPI address. Keep the default for github.com; for GitHub Enterprise Server use https://github.yourcompany.com/api/v3.
TokenCredentialYesPersonal access token or app token from the vault, with access to the repository. Or leave it empty and choose a connection that signs in, which gets and renews the token.
OwnerStringYesUser or organization that owns the repository, e.g. acme-corp.
RepoStringYesRepository name without the owner, e.g. billing-service.
PathStringYesPath of the file inside the repository.
RefStringNoBranch, tag or commit to read from. Empty means the default branch.
Save toFileNoLocal file to save the contents to, e.g. downloads/rates.json.

Outputs​

OutputTypeWhat it is
textStringFile contents as UTF-8 text (empty when saved to a file).
shaStringVersion id of the file; pass it to Create or update file to change it safely.
sizeNumberSize in bytes.