InTouch Hub · Blue Isle Software

GitHub Publish

Publish files to a GitHub repository — create, update, read or delete one file per call through the Contents API. Needs an API Key credential holding a personal access token.

Provided free and as is, without warranty of any kind — including merchantability, fitness for a particular purpose, and the accuracy or completeness of any result. See the licence. You are responsible for checking what this produces before relying on it.

developer-devopsdevopsgitgithubpublishcommitfilescontents

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

  1. 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.
  2. Store it once: Credentials → New → API Key, name it (e.g. github-blueisle), paste the token as the secret.
  3. 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

  1. 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

Customization

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.

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 via InTouch'.
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.