Recently, there is a new feature on Github - a profile page for user:
There are a ton of other posts about how to create a Github profile and all that, so I am not going to write a step-by-step guides here.
Instead, I am trying to explain how does a self-updating
Github Profile works.
So, how does it work? Let me try to explain it as simply as possible.
First, Github has now reserved a special repository for your profile - YOUR_USERNAME/YOUR_USERNAME. In my case, it would be RageBill/RageBill. If you create a README.md file in that repository, you will then see a button in your repository to display it on your profile page like this:
Ok, now that you know where is the source of the profile page, let's talk about how to make it self-updating.
For me, I have created a generate.py script in Python to generate a README.md for me:
To explain the script, it randomize a number between 1 to 151 (id of gen 1 pokemon), use that id to fetch data from PokéAPI, then write the result into a README.md file.
Once we have a script, the only thing we have to do is to make it update itself. The easiest way is to use Github Action.
For me, I have set it up with this yml file.
To highlight, there are two parts that make this work:
This parts tells Github Action to run the code on 1) push to master, and 2) once every hour.
Then, after running the script, the profile won't update by itself yet. You have to make it commit the README.md generated:
And that's it!
- There is a special repo YOUR_USERNAME/YOUR_USERNAME for your Github Profile.
- Write a script in any language (I used Python here) to generate a README.md for you.
- Configure Github Action to run the script for you.
- Don't forget to let Github Action commit the change to your repository.
- You can schedule the Github Action with cron to make the profile update by itself on a constant interval.