A CLI tool that visualizes GitHub contribution graphs as gamified GIFs
Project description
gh-space-shooter 🚀
Transform your GitHub contribution graph into an epic space shooter game!
Usage
Onetime Generation
A web interface is available for on-demand GIF generation without installing anything locally.
GitHub Action
Automatically update your game GIF daily using GitHub Actions! Add this workflow to your repository at .github/workflows/update-game.yml:
name: Update Space Shooter Game
on:
schedule:
- cron: '0 0 * * *' # Daily at midnight UTC
workflow_dispatch: # Allow manual trigger
permissions:
contents: write
jobs:
update-game:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: czl9707/gh-space-shooter@v1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
output-path: 'game.gif'
# write-dataurl-to: 'README.md' # for dataurl generation.
strategy: 'random'
Then display it in your README:

Action Inputs:
github-token(required): GitHub token for fetching contributionsusername(optional): Username to generate game for (defaults to repo owner)output-path(optional): Where to save the animation, supports.gifor.webp(default:gh-space-shooter.gif)strategy(optional): Attack pattern -column,row, orrandom(default:random)fps(optional): Frames per second for the animation (default:40)write-dataurl-to(optional): Write WebP as HTML<img>data URL to text filecommit-message(optional): Commit message for the update
From PyPI
pip install gh-space-shooter
From Source
# Clone the repository
git clone https://github.com/yourusername/gh-space-shooter.git
cd gh-space-shooter
# Install with uv
uv sync
# Or with pip
pip install -e .
Setup
-
Create a GitHub Personal Access Token:
- Go to https://github.com/settings/tokens
- Click "Generate new token (classic)"
- Select scopes:
read:user - Copy the generated token
-
Set up your environment:
# Copy the example env file touch .env echo "GH_TOKEN=your_token_here" >> .env
Alternatively, export the token directly:
export GH_TOKEN=your_token_here
CLI Usage
Generate Your Game Animation (GIF or WebP)
Transform your GitHub contributions into an epic space shooter!
# Basic usage - generates username-gh-space-shooter.gif
gh-space-shooter <username>
# Examples
gh-space-shooter torvalds
gh-space-shooter octocat
# Specify custom output filename (GIF or WebP)
gh-space-shooter torvalds --output my-epic-game.gif
gh-space-shooter torvalds -o my-game.webp
# Choose enemy attack strategy
gh-space-shooter torvalds --strategy row # Enemies attack in rows
gh-space-shooter torvalds -s random # Random chaos (default)
# Adjust animation frame rate
gh-space-shooter torvalds --fps 25 # Lower Frame rate, Smaller file size
gh-space-shooter torvalds --fps 40 # Default Frame rate, Larger file size
# Stop the animation earlier
gh-space-shooter torvalds --max-frame 200 # Stop after 200 frames
This creates an animated GIF showing:
- Your contribution graph as enemies (more contributions = stronger enemies)
- A Galaga-style spaceship battling through your coding history
- Enemy attack patterns based on your chosen strategy
- Smooth animations with randomized particle effects
- Your contribution stats displayed in the console
Generate Data URL (for embedding in HTML/Markdown)
For direct embedding in READMEs or HTML files, use --write-dataurl-to to generate a WebP data URL wrapped in an HTML <img> tag:
# Generate data URL and write to README.md
gh-space-shooter torvalds --write-dataurl-to README.md
# Short form
gh-space-shooter torvalds -wdt README.md
Using section markers: To use this feature, add section markers to your file where you want the game to appear:
# My Profile
<!--START_SECTION:space-shooter-->
<!--END_SECTION:space-shooter-->
## About Me
This will:
- Create new files with content wrapped in section markers, if file not present.
- Replace content between existing markers (preserving surrounding content)
- Raise error if markers are missing or in wrong order (no silent fallback)
Advanced Options
# Save raw contribution data to JSON
gh-space-shooter torvalds --raw-output data.json
# Load from previously saved JSON (saves API rate limits)
gh-space-shooter --raw-input data.json --output game.webp
# Combine options
gh-space-shooter torvalds -o game.webp -ro data.json -s column
# Generate data URL with custom strategy
gh-space-shooter torvalds -wdt README.md -s column
Data Format
When saved to JSON, the data includes:
{
"username": "torvalds",
"total_contributions": 1234,
"weeks": [
{
"days": [
{
"date": "2024-01-01",
"count": 5,
"level": 2
}
]
}
]
}
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file gh_space_shooter-1.0.4.tar.gz.
File metadata
- Download URL: gh_space_shooter-1.0.4.tar.gz
- Upload date:
- Size: 11.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
eaf1f3007e2667c48a21c78c85d65f240a542ac912f7a61faf502c6cb1184260
|
|
| MD5 |
4437e67f40b1f72dee08afe0617a734e
|
|
| BLAKE2b-256 |
ff45370f86ba5eb080131ef4b2f875b421c2632333a2f4bd13c9d08528738c3d
|
File details
Details for the file gh_space_shooter-1.0.4-py3-none-any.whl.
File metadata
- Download URL: gh_space_shooter-1.0.4-py3-none-any.whl
- Upload date:
- Size: 31.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9bce7727ade1b70d8cd260f1281ababfac998a18f52d1395f0edc7eb578b7abf
|
|
| MD5 |
f2faef9a1756a85e423849008d1f364a
|
|
| BLAKE2b-256 |
fe1500de0230cb198a1fd28339c47deb962e230a214f1af1090d2e17aee55332
|