How I Built A Self-Updating README On My Github Profile
On Hacker News I discovered the article Building a self-updating profile README for GitHub. I was very fascinated about this new GitHub feature and wanted to build something similar for my GitHub profile.
GitHub Profile README
GitHub profile READMEs are a new feature that allows users to have the content of a README markdown file rendered at the profile page.
To use this feature you just need to create a new repository that has the same name as your GitHub account. Mine is located at github.com/mokkapps/mokkapps
.This repository needs to be public and initialized with a README:
Now you will see a new section at the top of your profile page which renders the content of this new README file:
In my example, I am showing five links to the latest blog posts on my website and the latest tweet I published on Twitter. This information is automatically updated and I want to show you how I implemented this functionality.
Automatically Update The README
All the magic is happening in a GitHub Action defined in build.yml. This action runs on every Git push, every 32 minutes past the hour (configured via a cron schedule) or by manually clicking a button in the GitHub Action UI (by using workflow_dispatch
event).
The workflow performs these actions:
- Fetches the latest tweet from my Twitter account using the Twitter API, renders it to a PNG using headless Chrome (from an R script) and saves it as PNG which is then embedded in the README (taken from zhiiiyang).
- Runs a JavaScript script which fetches the five latest blog posts from my RSS feed and generates the final
README.md
(inspired by simonw) - Commits and pushes the changes to the master branch of this repo
The JS script is quite simple and has only ~50 lines of code.
Conclusion
The GitHub profile READMEs are a cool feature and by using GitHub Actions it can help us to provide up-to-date information for profile visitors.
But most importantly I had a lot of fun building it and this is more important than everything else.
Property Based Testing With Typescript
In my current project my colleague Michael Seifert introduced property based testing in our Python codebase. It was the first time I heard about it and it sounded fascinating, so I wanted to also implement it in our frontend code based on Vue.js with Jest as testing framework and TypeScript as programming language.
How To Automatically Generate A Helpful Changelog From Your Git Commit Messages
Creating a changelog is a usual task if a new software version is going to be released. It contains all the changes which were made since the last release and is helpful to remember what has changed in the code and to be able to inform the users of our code.