Bash.tv → GitHub → itch.io

Publish markdown guides from a repo as GitHub gists that work on their own. Local screenshots are uploaded to an image host, links to other guides point to their gists, other repo links go to github.com, "← Home / Next →" navigation is removed, and it refuses to publish if a username or secret is in the text. Keeps a link map so guides link to each other's gists, and updates existing gists in p...

Download skill (.zip) Files on GitHub

Guide → gist publisher

Gists can’t hold folders or images and don’t know about the repo, so a guide that looks fine in the repo breaks as a gist. This script fixes that and publishes it.

Needs

The Bash GitHub key with Gists: Read and write, attached for api.github.com. (See the GitHub setup guide. Fine-grained tokens can’t git push to gists, so this uses the API only.)

Publish

P=<skill>/scripts/publish-guide.py
python3 $P docs/03-itch-setup.md --dry-run --map gists/links.json --repo OWNER/REPO --term <username>   # preview
python3 $P docs/03-itch-setup.md          --map gists/links.json --repo OWNER/REPO --term <username>   # new secret gist
python3 $P docs/03-itch-setup.md --gist <id> --map gists/links.json --repo OWNER/REPO --term <username> # update
python3 $P docs/04-actions.md --extra .github/workflows/deploy.yml --extra scripts/export.sh           # attach files

What happens:

Part of the guide In the gist
![alt](images/x.png) and <img src> Uploaded to freeimage.host (cached by content, so re-runs reuse the same URL). --images repo uses raw GitHub URLs instead, which only work once the repo is public
Link to another guide that’s in the link map Link to that guide’s gist
Other relative links (../scripts/x.sh) github.com/OWNER/REPO/blob/main/... with --repo, otherwise plain text with a warning
First and last navigation lines ([← Home](...), [← Previous] · [Next →]) Removed (--keep-nav to keep them)
--term words, tokens, webhook URLs, private keys Stops and publishes nothing

Gists are secret by default (unlisted: anyone with the link can open them). Use --public only when the user asks. The script prints the short link form (gist.github.com/<id>), which doesn’t show the username.

Keeping a set of guides in sync

  1. Keep gists/links.json in the repo: {"docs/01-setup.md": "https://gist.github.com/<id>", …}. The script adds each new gist to it.
  2. Publish guides that others link to first, so their gist links exist. Then publish the rest. If two guides link to each other, publish both, then re-run the first with --gist <id>.
  3. After editing a guide, re-run with --gist <id> (the ID is in the link map). Re-run attached files with --extra too, or they’ll go stale.
  4. Optionally keep a table of all gists in the repo’s README.

Checks before telling the user it’s done

Notes