A workflow that updates your Recent Posts
section of README file listening to a REST API endpoint other than a SOAP one with the help of GitHub Actions. (Like RSS feed updaters)
This repository helps you in case of showing your weblog's recent posts on your profile README file so then users will be able to check your latest activities.
- A RESTful endpoint that responses JSON data.
- Profile readme for showing the result. (
username/username/README.md
) - Patience.
All you need is to clone this repository and copy the feed_updater
directory right in the root path of your repository. Once you did that, you need to add the Recent Posts
section for updates. Finally, you create the workflow.
Before you clone this repository, make sure you have your own reposotory already cloned locally.
git clone https://github.com/<yourusername>/<yourusername> && git clone https://github.com/lnxpy/restful-post-feed
Then, copy the required directory as follows.
cp -r restful-post-feed/feed_updater <yourusername>
Once you get your repository ready, open up the <yourusername>/README.md
file in a text editor and add the following snippet somewhere in your readme file.
# My Recent Posts
<!--POSTS:START-->
<!--POSTS:END-->
Open up the <yourusername>/feed_updater/settings.py
file for some basic configuration. Here is a simple hint for a correct configuration.
config = {
'endpoint': '', # --> the restful endpoint that responses the JSON data (your posts)
'title': '', # --> the title field name in the returned JSON data
'url': {
'pattern': '', # --> a python pattern to redirect users to the post index
'keys': [], # --> replacement fields for the pattern
}
}
Simply create the <yourusername>/.github/workflows/
directory and copy the original workflow.
mkdir -p <yourusername>/.github/workflows/ && cp restful-post-feed/workflows/post-section-updater.yml <yourusername>/.github/workflows/
You're done. Workflow will be trigger every 6 hours. You can change it from the schedule
section in the yaml file.
Here is an example repository that uses the same structure for updating the Recent Posts
section of the readme file. You can refer to that repository anytime.