Automating GitHub Profile README Updates with GitHub Actions and Repository Dispatch
This guide explains how to set up a GitHub Actions workflow that automatically fetches the latest blog posts via RSS and updates the special README.md of a same‑named GitHub profile repository, using scheduled runs and repository_dispatch events triggered by a curl command.
Recently I implemented a workflow that automatically synchronizes each newly published blog article to my GitHub profile page using GitHub Actions.
The workflow requires three key steps:
Create a personal repository with the same name as your GitHub username; the README.md in this repository is displayed on your profile.
Use GitHub Actions to fetch the latest blog posts and update the README.md .
Trigger the update only when a new article is published, using a webhook.
The special repository (named after your GitHub account) shows its README.md on your profile. For example, if your GitHub username is GeBiLaoWang , creating a repository called GeBiLaoWang and adding a README.md will make it appear on your homepage.
To automatically fetch articles, I used the open‑source blog-post-workflow project, which can retrieve the latest posts from an RSS feed (and also supports StackOverflow and YouTube). Adding the following workflow file to the special repository enables this:
name: Latest blog post workflow
on:
schedule:
- cron: '* 2 * * *'
workflow_dispatch:
jobs:
update-readme-with-blog:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gautamkrishnar/blog-post-workflow@master
with:
# My blog RSS link
feed_list: "https://shenxianpeng.github.io/atom.xml"
# Get the latest 10 posts
max_post_count: 10This schedule runs daily at 02:00 UTC, but a more efficient approach is to trigger the workflow only when a new post appears. GitHub Actions provides the repository_dispatch webhook for this purpose.
The dispatch event can be customized; I defined an event type called special_repository . The workflow file is adjusted to listen for this event:
# special_repository.yml
name: Latest blog post workflow
on:
repository_dispatch:
# Custom event type
types: [special_repository]
workflow_dispatch:
jobs:
update-readme-with-blog:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: gautamkrishnar/blog-post-workflow@master
with:
feed_list: "https://shenxianpeng.github.io/atom.xml"
max_post_count: 10To send the special_repository dispatch event, a simple curl command calls the GitHub API:
curl -XPOST -u "${{ secrets.PAT_USERNAME }}:${{ secrets.PAT_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/shenxianpeng/shenxianpeng/dispatches \
--data '{"event_type": "special_repository"}'A second workflow file sends this dispatch when the master branch is updated:
name: Trigger special repository
on:
push:
branches:
- master
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Send repository dispatch event
run: |
curl -XPOST -u "${{ secrets.PAT_USERNAME }}:${{ secrets.PAT_TOKEN }}" \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Content-Type: application/json" \
https://api.github.com/repos/shenxianpeng/shenxianpeng/dispatches \
--data '{"event_type": "special_repository"}'Note: PAT_USERNAME and PAT_TOKEN must be added to the repository's Settings → Secrets.
With these configurations, the GitHub profile README is automatically updated whenever a new blog post is published.
If you have other interesting use‑cases, feel free to share them in the comments.
DevOps Engineer
DevOps engineer, Pythonista and FOSS contributor. Created cpp-linter, commit-check, etc.; contributed to PyPA.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.