feat: snake on the profile page
All checks were successful
snake / generate (push) Successful in 1m26s
All checks were successful
snake / generate (push) Successful in 1m26s
This commit is contained in:
commit
5947717b7c
44
.gitea/workflows/snake.yml
Normal file
44
.gitea/workflows/snake.yml
Normal file
@ -0,0 +1,44 @@
|
||||
# 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 (docs/11).
|
||||
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/<name>/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
|
||||
4
README.md
Normal file
4
README.md
Normal file
@ -0,0 +1,4 @@
|
||||
<picture>
|
||||
<source media="(prefers-color-scheme: dark)" srcset="https://git.lukaszboryn.dev/lukabor/.profile/raw/branch/output/snake-dark.svg">
|
||||
<img alt="Contribution heatmap eaten by a snake" src="https://git.lukaszboryn.dev/lukabor/.profile/raw/branch/output/snake.svg">
|
||||
</picture>
|
||||
Loading…
x
Reference in New Issue
Block a user