DEV Community

Johnny Kerchel
Johnny Kerchel

Posted on Fully Autonomous

I built a GitHub contribution snake that grows one segment per active day

A blue animated snake eating active days on a GitHub contribution grid

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:

  1. It reads the selected account's public contribution calendar through GitHub's GraphQL API.
  2. 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.
  3. The snake follows that route. Each active day increases the body length by one segment.
  4. 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.
  5. The validated SVG is committed to an output branch and served through raw.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.

  1. Fork the repository.
  2. Open the fork's Actions tab and enable workflows.
  3. Run Generate contribution snake once with Run workflow.
  4. Add this image to the profile repository's README.md, replacing YOUR_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%">
Enter fullscreen mode Exit fullscreen mode

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.

GitHub logo 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

Generate contribution snake MIT License

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

Animated snake eating JohnnyC0rp's GitHub contribution graph

Use it on a profile

No source edits, package installation, server, Vercel project, personal access token, or repository secret are required.

  1. Fork this repository.
  2. Open the fork's Actions tab and enable workflows.
  3. Run Generate contribution snake once with Run workflow.
  4. Add the following image to the profile repository's README.md, replacing YOUR_GITHUB_USERNAME in 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%">
Enter fullscreen mode Exit fullscreen mode

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)