# Draws the contribution heatmap as a snake game and publishes the SVGs to # the orphan `output` branch, which README.md embeds. Runs on the mithlond # runner (OKF/guides/12). name: snake on: schedule: # Daily, clear of the 03:30 backup window when Gitea is stopped. - cron: "0 5 * * *" workflow_dispatch: push: branches: [main] defaults: run: shell: sh jobs: generate: runs-on: alpine steps: - name: Generate SVGs from the Gitea heatmap run: | host=${GITHUB_SERVER_URL#https://}; host=${host%/} # Gitea serves the same /api/v1/users//heatmap as Forgejo. npx --yes generate-snake-animation@3.5.0 \ --forgejo_user="$host/$GITHUB_REPOSITORY_OWNER" \ --output=dist/snake.svg \ --output='dist/snake-dark.svg?palette=github-dark' - name: Publish to the output branch env: TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | apk add --no-cache -q git host=${GITHUB_SERVER_URL#https://}; host=${host%/} cd dist git init -q -b output git config user.name "snake" git config user.email "actions@$host" git add . git commit -qm "Update snake" # Single orphan commit, force-pushed: old SVGs do not pile up. git push -qf "https://x-access-token:$TOKEN@$host/$GITHUB_REPOSITORY.git" output