GitHub Publish
Put a file into a GitHub repository — create it, update it, read it back or delete it — through the
Contents API. One file per call, committed
straight to a branch. No clone, no working copy, no git binary on the server.
Part of the GitHub family: github (issues and pull requests),
github-release (releases and binary assets),
github-repo (repository administration),
github-insights (traffic and popularity).
Use case
A workflow generates something — a report, a catalogue page, a README that has to match what the server actually has — and the result belongs in a repository rather than an inbox. This publishes it, on a schedule if you like, with a real commit message.
Setup
- Create a personal access token at https://github.com/settings/tokens. Fine-grained, scoped to
the repositories you publish to, with Contents: read and write. A classic token needs
repo. - Store it once: Credentials → New → API Key, name it (e.g.
github-blueisle), paste the token as the secret. - Name that credential on every github-publish task:
"credentialName": "github-blueisle".
There is no apiKey input, deliberately. A token typed into a workflow travels into that
workflow's exports, its activity log and any repository it is committed to.
Operations
| operation | what it does | required |
|---|---|---|
put-file |
create the file, or update it if it is already there | owner, repo, path, and content or contentFile |
get-file |
read a file back as text, plus its blob sha | owner, repo, path |
delete-file |
remove a file, with a commit message | owner, repo, path |
list-dir |
list a directory (blank path = repository root) |
owner, repo |
put-file is create-or-update
The Contents API is where most integrations break: creating a file sends no sha, but replacing
one must send the sha of the blob being replaced or GitHub answers 422. This tool looks the sha
up itself, so the caller never has to know which case they are in. The published action output
says which happened — created or updated.
Size
The Contents API caps a single file at 1 MB, and this tool refuses larger content with a clear
message rather than letting GitHub reject it. Ship anything bigger — an installer, an archive — as
a release asset with github-release.
Pipeline
run(python,github_publish.py) — resolves the token from the bound credential, looks up the existing blob sha when writing, calls the Contents API, publishes the response.
Publishes
result— the response body, or the decoded file text forget-filestatus— HTTP status code as a stringsha— blob sha of the file after the call (or of the file read)url— the file's page on github.com, after a successfulput-fileaction—createdorupdated
Customization
branchcommits somewhere other than the default branch. The branch must already exist.messagesets the commit message; the default names the file and says it came from InTouch.shacan be supplied to force a specific parent blob — useful when you have already read the file and want the write to fail if it changed underneath you.- Non-2xx responses are published rather than raised, so a workflow can branch on
status.
Source
tool.iml (definition) · github_publish.py (implementation) · manifest.yaml (catalog entry)
Publishes
The keys a later task may reference as {{taskName.key}}. Referencing anything not listed here resolves to nothing at run time.
actionresultshastatusurl
Input Properties
Every property this tool accepts, from its own tool.iml.
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
operation |
string | yes | — | One of: put-file, get-file, delete-file, list-dir |
owner |
string | yes | — | Repository owner — the user or organisation login, e.g. 'intouch-ai-core'. |
repo |
string | yes | — | Repository name, e.g. 'intouch-ai'. |
path |
string | no | — | Path of the file inside the repository, e.g. 'docs/report.md'. Required for every operation except list-dir, where it names a directory (blank = repository root). |
content |
string | no | — | File content as text, for put-file. Use contentFile instead for anything binary. |
contentFile |
string | no | — | Path to a file ON THE SERVER whose bytes are published, for put-file. Takes precedence over content. Capped at 1 MB by the Contents API. |
message |
string | no | — | Commit message. Defaults to 'Update |
branch |
string | no | — | Branch to commit to. Blank uses the repository's default branch. |
sha |
string | no | — | Blob sha of the file being replaced or deleted. Leave blank — the tool looks it up, which is what makes put-file create-or-update. |