Most contribution-snake animations use the graph as a board. I wanted the activity data to affect the snake itself.
In this version, the snake starts with three segments and gains exactly one segment whenever it reaches a day with at least one contribution. Ten commits on one date still count as one active day and one new segment.
How it works
A GitHub Actions workflow runs at 17 minutes past every hour, or on demand:
- It reads the selected account's public contribution calendar through GitHub's GraphQL API.
- The generator builds a route that visits every cell once. It starts with a Hamiltonian backbone, then applies seeded backbite moves so the path is less mechanical while remaining deterministic.
- The snake follows that route. Each active day increases the body length by one segment.
- The generator writes one self-contained SVG. The head uses
animateMotion; the body uses animated stroke dash values; eaten contribution cells disappear at the matching frame. - The validated SVG is committed to an
outputbranch and served throughraw.githubusercontent.com.
The route seed combines the username with the latest calendar date. That keeps a generated result stable while still allowing the route to change as the contribution calendar advances.
The SVG also follows the viewer's light or dark color scheme. It contains no scripts or external resources, and the validator rejects credential-like text before publishing.
Add it to a GitHub profile
No source edits, package installation, server, personal access token, or repository secret are required.
- Fork the repository.
- Open the fork's Actions tab and enable workflows.
- Run Generate contribution snake once with Run workflow.
- Add this image to the profile repository's
README.md, replacingYOUR_GITHUB_USERNAME:
<img src="https://raw.githubusercontent.com/YOUR_GITHUB_USERNAME/growing-contribution-snake/output/github-contribution-grid-snake.svg" alt="Growing GitHub contribution snake" width="100%">
The workflow uses the fork owner's username by default. To render another public profile, add an Actions repository variable named PROFILE_USERNAME.
The generator is dependency-free JavaScript for Node.js 20, and the project is available under the MIT license.
JohnnyC0rp
/
growing-contribution-snake
A fork-ready GitHub contribution snake that grows as it eats real activity, generated automatically with GitHub Actions.
Growing Contribution Snake
A real GitHub contribution snake that gains one body segment whenever it eats an active day. The dependency-free generator serves it as a small static SVG file from GitHub instead of a cold-starting web service.
Live demo
Use it on a profile
No source edits, package installation, server, Vercel project, personal access token, or repository secret are required.
- Fork this repository.
- Open the fork's Actions tab and enable workflows.
- Run Generate contribution snake once with Run workflow.
- Add the following image to the profile repository's
README.md, replacingYOUR_GITHUB_USERNAMEin the repository URL:
<img src="https://raw.githubusercontent.com/YOUR_GITHUB_USERNAME/growing-contribution-snake/output/github-contribution-grid-snake.svg" alt="Growing GitHub contribution snake" width="100%">
The workflow defaults to the fork owner automatically. If the target profile has a different name, create an Actions repository variable named PROFILE_USERNAME; no code change is needed.
If the fork is renamed, replace…
I would especially value feedback on two things: whether the motion is easy to follow, and whether the fork-to-profile setup is clear without reading the source.
Top comments (0)