Varun Sridharan
VS Writings

VS Writings

How To Show Latest Hashnode Blog Posts In Github Profile Readme?

How To Show Latest Hashnode Blog Posts In Github Profile Readme?

Varun Sridharan's photo
Varun Sridharan

Published on Nov 5, 2020

2 min read

Subscribe to my newsletter and never miss my upcoming articles

Hi There,

I recently decided to start my own blog using Hashnode. after setting up the blog I found out that there is no GitHub action which can update my Github Profile Readme with the latest posts I write here.

So I decided to jump into work and started to create a GitHub action that can do the job.


πŸŽ‰ Github Action For Hashnode Blogs πŸŽ‰

Using this action you will be able to display the latest posts from your account to your Github Profile Readme or Update it in a Github Gist which can be pinned to your profile later & it can render the latest posts data in multiple styles.

Setting up with Github Profile Readme

I assume that you already have created your Github Profile Readme

Step 1 :

Add the below content to your README.md file in Github Profile

## My Latest Blog Posts πŸ‘‡
<!-- HASHNODE_BLOG:START -->
<!-- HASHNODE_BLOG:END -->

https://s2.do-spaces.com/2020/Nov/05/1604579158-16.jpg

Step 2 :

Create blog.yml file inside of .github/workflows/ folder in your Github Profile Readme repository

name: "πŸ“š Blog Updater"

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *' # Runs Every Day

jobs:
  update_blogs:
    name: "Update Blogs"
    runs-on: ubuntu-latest
    steps:
      - name: "πŸ“₯  Fetching Repository Contents"
        uses: actions/checkout@main

      - name: "πŸ“š  Hashnode Updater"
        uses: "varunsridharan/action-hashnode-blog@main"
        with:
          USERNAME: 'your-username'
          COUNT: 10
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

That's it now we have configured the workflow & README.md file. and the workflow is set to run once every day or when manually triggered.

now navigate to the Actions tab in that repository, select the workflow that we added and click RUN

How To Run Github Workflow Manually

Note

This action can be used with Gist or with any other repository For more information on this action please check the GitHub repository

Β 
Share this