Keeping track of OSS contributions

A few months ago, I created this page to list some of my open-source contributions. Its purpose is not to brag around, even though I love seeing it expanding month by month as it encourages me keep on going.

Generally, my open-source work reflect things I’m interested in at my daily job, things I’m researching, or things I’m having fun and relaxing with, so it’s nice to have a list ready for quick reference.

Here’s how I’m updating this list semi-automatically, using the GitHub API, bash and awk. The generator script is pretty simple. Its structure looks like this

#!/bin/bash
cat << EOF
---
layout: page
title: Open Source
permalink: /opensource/
---

...
... // content goes here
...

EOF

This allows to inline bash code using subshells, like $().

The contribution list is updated using the following pipeline

$(curl \                                                  # We'll GET request the Github API
-H "Accept: application/vnd.github.v3+json" \             # Explicitly request v3 API version
https://api.github.com/repos/:owner/:repo/commits\?author\=:author \    # JSON response of all :owner/:repo and :author commits
| jq '.[] | "\(.html_url)DELIM\(.commit.message)"' \      # Filter for the URL and commit message
| gsed -r 's/^"|"$//g' \                                  # Filter out leading and trailing quotes
| awk -F '\\\\n' '{print $1}' \                           # Split commit message to get only commit title
| awk -F 'DELIM' '{printf "* [%s](%s)  \n", $2, $1}')     # Print out the markdown link

So whenever I’d like to refresh the list I just ./opensource.sh > opensource.md – done!

Also as December is getting closer, and so are End of Year reviews, so this might be useful.

Until next time, bye!

Written on November 13, 2020