Files
2026-11-30 12:09:18 -06:00

83 lines
3.0 KiB
YAML

name: readme
# Regenerates the self-updating blocks in README.md on GitHub.
#
# The generator is not copied here: this job clones the public Gitea repo
# (git.jonb.io/jblu/.profile) and runs tools/gen_readme.py from there, so the
# code lives in exactly one place. Every data source is reached over its public
# FQDN, so nothing internal is needed:
#
# git.jonb.io Gitea API (anonymous is enough for the public repos)
# k.jonb.io Komodo
# todo.jonb.io Vikunja
# up.jonb.io Uptime Kuma
#
# Repo secrets, both optional - a missing one keeps the previous block text:
# KOMODO_API_KEY / KOMODO_API_SECRET
# VIKUNJA_TOKEN
#
# This same file also sits in the Gitea repo, where Gitea Actions would pick it
# up; the `github.repository` guard keeps it from running there.
#
# Cron is UTC, every 6 hours: 00/06/12/18:23 UTC = 18:23/00:23/06:23/12:23 CST.
# Deliberately off the top of the hour - GitHub drops queued schedule jobs at
# peak load, and the start of every hour is peak (docs: "Events that trigger
# workflows" -> schedule). The 23-minute offset also keeps this run behind the
# Gitea run it clones the generator from.
on:
schedule:
- cron: "23 */6 * * *"
workflow_dispatch:
push:
branches: [main]
paths:
- ".github/workflows/readme.yml"
jobs:
refresh:
if: github.repository == 'jonbranan/jonbranan'
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fetch generator from git.jonb.io
run: git clone --depth 1 https://git.jonb.io/jblu/.profile.git /tmp/src
- name: Regenerate
env:
KOMODO_API_KEY: ${{ secrets.KOMODO_API_KEY }}
KOMODO_API_SECRET: ${{ secrets.KOMODO_API_SECRET }}
VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }}
run: |
# GitHub's sanitizer strips style/class/inline <svg>, so the coloured
# terminal card ships as a committed SVG behind <picture> instead of
# the inline <pre> Gitea gets.
python3 /tmp/src/tools/gen_readme.py --write --svg /tmp/svg --terminal-image
cp /tmp/src/README.md README.md
cp /tmp/svg/terminal-dark.svg /tmp/svg/terminal-light.svg .
- name: Check links are public
run: python3 /tmp/src/tools/gen_readme.py --check-links
- name: Commit
run: |
git config user.name trex
git config user.email nanobot@jonb.io
# Re-running an older run checks out that run's head SHA, which can be
# behind main, so a plain push is rejected as non-fast-forward. Move
# HEAD to the current tip first; the regenerated files are
# authoritative, so they are re-staged on top of it.
git fetch --quiet origin main
git reset --quiet origin/main
git add README.md terminal-dark.svg terminal-light.svg
if git diff --cached --quiet; then
echo "no change"
exit 0
fi
git commit -m "chore: refresh profile README"
git push