contribution-graph
A simple graph app that displays an aggregated calendar graph of contributions in Github and Gitlab
A simple graph app that displays the number of contributions to open source I've done.
It supports Gitlab and Github, both hosted in the cloud or in private instances. For private instances, or just accounts that have been locked down, you will need to provide an access token.
This page only supports one calendar per instance. It's single-user, and not multi-tenant at all.
Installation
Super-easy thanks to docker. Outside of docker, not hard at all.
Docker
docker run --env-file /path/to/envvars r.library.evaryont.me/evaryont/contribution-graph:latest
Outside of a container
bundle install --deployment
bundle exec /usr/bin/ruby app.rb
Environment Variables
contribution-graph
requires 3 environment variables to function:
- GITLAB_HOST: Which gitlab you're pointing to. Includes protocol, e.g. 'https://gitlab.com'
- GITLAB_API_PRIVATE_TOKEN: Access token for your account. The username will be derived from it.
- GITHUB_USER: The github profile to pull calendar information about.
And I also recommend setting RACK_ENV
to 'production', but that's not
absolutely necessary.
Errors can be optionally tracked via Sentry. Set SENTRY_DSN
and it'll be
configured automatically.
API
There isn't much of an API. Small, yet still sorta useful:
GET /calendar.svg
This is the actual graph! Take the url, embed it everywhere you want. Show off your graphs!
Parameters:
- colors: Which color scheme to use to fill in the graph.
GET /data.json
Returns the original data used to generate the graph. It's a dictionary of date -> count entries.
GET /colors.json
Server-supported color schemes. Each scheme is given a name.
POST /refresh
Force the app to download the latest data and regenerate the graph. It'll do so automatically at start, but will otherwise not attempt to refresh the data on it's own. You should run an hourly cron job to keep it updated.
License
Licensed under the GPLv3. Copyright (C) 2017-2018 Colin Shea.