Skip to main content

Create or update file

Commit a new or changed file to a branch, from text or from a local file.

Command in the GitHub toolkit · id ooa.github/put_file · 10 inputs (5 required), 2 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.
MessageStringYesCommit message.
TextStringNoNew contents as text. Use this or local_file.
Local fileFileNoLocal file whose contents to commit. Use this or text.
BranchStringNoBranch to commit to. Empty means the default branch.
Current version (SHA)StringNoCurrent version id of the file. Leave empty to look it up; it is not needed for new files.

Outputs​

OutputTypeWhat it is
commit_shaStringId of the new commit.
shaStringNew version id of the file.