What is the Contribution Snake Animation?
Created by Platane, snk (Snake Generator) is a GitHub Action that reads your GitHub contribution graph history and generates an animated vector SVG where a snake eats your green contribution squares like the classic arcade game.
Because GitHub contribution graphs update daily, setting up a scheduled GitHub Action allows your snake animation to update automatically every 24 hours without any manual effort.
Step 1: Create the GitHub Actions Workflow File
In your special profile repository (e.g. github.com/username/username), create a file at the path .github/workflows/snake.yml with the following content:
name: generate animation
on:
# run automatically every 24 hours
schedule:
- cron: "0 0 * * *"
# allows to manually run the Job at any time
workflow_dispatch:
# run on every push on the main branch
push:
branches:
- main
jobs:
generate:
permissions:
contents: write
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
# generates a snake game from a github user (<github_user_name>) contributions graph, output a svg animation at <svg_out_path>
- name: generate github-contribution-grid-snake.svg
uses: Platane/snk/svg-only@v3
with:
github_user_name: ${{ github.repository_owner }}
outputs: |
dist/github-contribution-grid-snake.svg
dist/github-contribution-grid-snake-dark.svg?palette=github-dark
# push the content of <build_dir> to a branch
# the content will be available at https://raw.githubusercontent.com/<github_user>/<repository>/<target_branch>/<file> , or as github page
- name: push github-contribution-grid-snake.svg to the output branch
uses: crazy-max/ghaction-github-pages@v3.1.0
with:
target_branch: output
build_dir: dist
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}Step 2: Enable Workflow Permissions
- Go to your profile repository on GitHub and click Settings.
- In the left sidebar, expand Actions and click General.
- Scroll down to Workflow permissions and select Read and write permissions.
- Click Save.
Step 3: Trigger the First Workflow Run
Go to the Actions tab in your repository, select generate animation under Workflows, click Run workflow, and hit the green button. Once completed, a new output branch will be created containing your snake SVG file.
Step 4: Embed the Snake SVG in Your README
Add the following Markdown image tag to your README.md file (replace yourusername with your GitHub handle):
Generate Cyberpunk & Snake Layouts
ProfileCrest generates complete Snake Action workflow files and Cyberpunk terminal layouts automatically.
🚀 Open ProfileCrest Generator