GitHub Repository Admin
Create, describe and retire GitHub repositories — Repos API. The operations you rarely need and then need badly, at a moment when clicking through a website is the wrong answer.
Part of the GitHub family: github (issues and pull requests),
github-publish (files),
github-release (releases and assets),
github-insights (traffic and popularity).
Use case
Provision a repository with the same description, homepage and topics every time. Audit what an organisation owns and whether any of it is public by accident. Archive what is finished. Delete what should not exist.
Setup
- Create a personal access token at https://github.com/settings/tokens.
- Creating, editing, archiving: Administration: write (fine-grained) or
repo(classic). - Deleting also needs
delete_repo— see below. - Store it once: Credentials → New → API Key, name it (e.g.
github-blueisle), paste the token. - Name that credential on every github-repo task.
Operations
| operation | what it does | required |
|---|---|---|
create-repo |
create a repository, in an org or under the token owner | repo (+ org for an org) |
get-repo |
metadata — visibility, default branch, counts | owner, repo |
update-repo |
description, homepage, default branch, rename, private, archived | owner, repo + a field |
set-topics |
replace the repository's topic list | owner, repo, topics |
list-repos |
everything an org or user owns, newest activity first | org or owner |
delete-repo |
delete a repository, permanently | owner, repo, confirm |
Two things that will bite you
Scopes are not one thing. Creating a repository needs repo / Administration: write. Deleting
one additionally needs delete_repo, a separate scope that gh auth login does not grant by
default — because deletion cannot be undone. A token that creates repositories happily will still
answer 403 on delete. When that happens the tool says exactly this rather than reporting a bare
permission error.
delete-repo refuses to run without confirm. You must pass the exact owner/repo string
being deleted. A typo in repo would otherwise delete whatever that typo happens to name, and there
is no undo — GitHub keeps a short restore window for some accounts and no guarantee for any of them.
Defaults worth knowing
create-repomakes the repository private unlessprivateis"false". Public is a decision, not an accident.autoInit: "true"gives the new repository an initial commit, so it has a default branch thatgithub-publishcan immediately commit to. Without it, the first write to an empty repository answers409.set-topicsreplaces the topic list. Pass every topic you want, not just the new one.- Archiving through the API is one-way — GitHub does not support unarchiving through it.
Pipeline
run(python,github_repo.py) — resolves the token from the bound credential, calls one Repos endpoint, publishes the response.
Publishes
result— the raw JSON response bodystatus— HTTP status code as a stringfullName,url— aftercreate-repo:owner/nameand the repository's page
Source
tool.iml (definition) · github_repo.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.
fullNameresultstatusurl
Input Properties
Every property this tool accepts, from its own tool.iml.
| Property | Type | Required | Default | Description |
|---|---|---|---|---|
operation |
string | yes | — | One of: create-repo, get-repo, update-repo, set-topics, list-repos, delete-repo |
org |
string | no | — | Organisation login, e.g. 'intouch-ai-core'. For create-repo, blank creates the repository under the token owner's personal account instead. |
owner |
string | no | — | Owner of an existing repository. Defaults to org when that is set. |
repo |
string | no | — | Repository name. |
description |
string | no | — | One-line description shown on the repository page and in search. |
homepage |
string | no | — | Website URL shown beside the description. |
private |
string | no | — | true or false. create-repo defaults to true — a repository is private unless you say otherwise. |
autoInit |
string | no | false |
true to create the repository with an initial commit, so it has a default branch immediately. |
topics |
string | no | — | Comma-separated topics for set-topics. REPLACES the existing topics — pass the full list. |
newName |
string | no | — | New repository name, for update-repo. Renaming leaves redirects behind. |
archived |
string | no | — | true to archive the repository read-only. Unarchiving through the API is not supported by GitHub. |
defaultBranch |
string | no | — | Name of the branch to make default. It must already exist. |
confirm |
string | no | — | Required by delete-repo only: the exact 'owner/repo' being deleted. Deletion cannot be undone. |