72 lines
2.3 KiB
YAML
72 lines
2.3 KiB
YAML
name: readme
|
|
|
|
# Regenerates the self-updating blocks in README.md.
|
|
#
|
|
# The generator lives in tools/gen_readme.py and is stdlib-only, so there is
|
|
# nothing to install. Auth is the built-in per-job GITEA_TOKEN (write on this
|
|
# repo's contents, read-only on public repos) - no personal access token.
|
|
#
|
|
# Optional repo secrets, both degrade gracefully when absent:
|
|
# KOMODO_API_KEY / KOMODO_API_SECRET live stack + host counts
|
|
# VIKUNJA_TOKEN recently completed homelab tasks
|
|
#
|
|
# Cron is UTC, every 6 hours: 00/06/12/18 UTC = 18:00/00:00/06:00/12:00 CST.
|
|
# A run only commits when a block actually changed, so a quiet cycle is a
|
|
# no-op rather than a commit.
|
|
|
|
on:
|
|
schedule:
|
|
- cron: "0 */6 * * *"
|
|
workflow_dispatch:
|
|
push:
|
|
branches: [main]
|
|
paths:
|
|
- "tools/**"
|
|
- ".gitea/workflows/readme.yml"
|
|
pull_request:
|
|
paths:
|
|
- "tools/**"
|
|
- "README.md"
|
|
- ".gitea/workflows/readme.yml"
|
|
|
|
jobs:
|
|
refresh:
|
|
# a bot commit must not re-trigger the job
|
|
if: github.event_name != 'push' || github.actor != 'trex'
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Regenerate
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
|
KOMODO_API_KEY: ${{ secrets.KOMODO_API_KEY }}
|
|
KOMODO_API_SECRET: ${{ secrets.KOMODO_API_SECRET }}
|
|
VIKUNJA_TOKEN: ${{ secrets.VIKUNJA_TOKEN }}
|
|
run: python3 tools/gen_readme.py --write
|
|
|
|
- name: Check links are public
|
|
run: python3 tools/gen_readme.py --check-links
|
|
|
|
- name: Commit
|
|
if: github.event_name != 'pull_request'
|
|
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 README is
|
|
# authoritative, so it is re-staged on top of it.
|
|
git fetch --quiet origin main
|
|
git reset --quiet origin/main
|
|
git add README.md
|
|
if git diff --cached --quiet; then
|
|
echo "no change"
|
|
exit 0
|
|
fi
|
|
git commit -m "chore: refresh profile README"
|
|
git push
|