Retrospectively looking at your Github contributions

Sometimes it is good to look at your contribution history on the platform you are involved in so much. It gives an idea about what you have done, what happened to your life during certain moments, etc… Github’s contribution history is great to see that it also allows you to select the year, but it forgets to provide a full retrospective history.

While I had been pondering how I should look for the previous years, I had known that the only way of doing it by an API call that Github provides. So, I’ve gone into the API docs to understand which API gives the need I was in; it turned out it was the Graphql API of Github hosted on

I knew the language I would use to write the API; it was Scala. Henceforth, what you will see as the examples and code pieces will be the Scala source code.

If we take a closer look at the Github API, it needs a token, that’s obvious, then a Grapql query that accepts a username and year that you’re interested in:

def graphqlQuery(name: String, year: Int): String = {
         |  "query": "query {  user(login: \\"$name\\") { name  contributionsCollection(from: \\"$year-01-01T00:00:00\\" to:\\"$year-12-31T23:59:59\\" ) {startedAt contributionYears  contributionCalendar { totalContributions weeks { contributionDays {contributionCount date} } } } } }"

And it creates a query string that consists of a given username and a year So, an HTTP GET request is made with this query, and we get results for the given year, although year actually is a multiple-input that the user can provide. That naturally leads us to see what the URL looks like;,2009,2010,2011,2012,2013,2014,2015,2016,2017,2018,2019,2020

So, it asks Github’s API for given user’s contributions from 2008 until 2020. The result is an SVG image.


The project is on Github and hosted on Heroku as free.

comments powered by Disqus