Member-only story
How to Build a Dynamic GitHub Profile with GitHub Actions and PHP
Last year, GitHub quietly released a feature that was quickly noticed by the community — profile READMEs
A profile README is a global README
file for your GitHub profile, which you can set up by creating a public repository whose name is identical to your GitHub username. For instance, as my username is osteel
, I created the osteel/osteel
repository.
A little box like this one should appear while you add your own:

Once the repository is created, add a README
file with a short description explaining how great you are, and your GitHub profile page will display its content by default:

Neat and simple.
As I was browsing examples for some inspiration, I stumbled upon Simon Willison’s version, which features some dynamic content like recent work and blog publications. He explained how he used a combination of GitHub Actions and Python to achieve this in a blog post, and I decided to do something similar with PHP.
The placeholder
The first thing to do is to create a placeholder in the README
file where the dynamic content will go. Since I wanted to automatically insert the latest publications of my blog, I used the following tags:
<!-- posts --><!-- /posts -->
You might recognise this format; since Markdown files also support HTML, I used some HTML comment tags to make sure they wouldn’t show up on my profile page.
The PHP script
I can’t remember the last time I wrote some PHP without a framework; as a result, I had to do a quick search just to get started with a basic PHP script and some Composer dependencies.
Turn out it’s quite simple! The first step is to initialise the project with the following command:
$ composer init