DEV Community

Cover image for Auto Dev.to's posts updater on GitHub readme
vito.mohagheghian
vito.mohagheghian

Posted on • Edited on

Auto Dev.to's posts updater on GitHub readme

To show your latest dev.to posts in the GitHub page readme is awesome 🌈, because:

  1. Show you're actively creating blogs ✍️
  2. Github page's viewers become familiar with your Dev.to blog 🚀

But how to achieve this:

1. The first step is ( Create a username repo )

Make a repository in your GitHub page with your own username - if you haven't created that yet.
like this: https://github.com/vito-mohagheghian/vito-mohagheghian

And will appear in your profile like this.

Image description

2. Edit readme.md File

Copy/Paste the code below, where you wanna your latest blogs appear in the readme.md file.

they won't appear in preview mode.

## Latest Blog posts
<!-- BLOG-POST-LIST:START -->
<!-- BLOG-POST-LIST:END -->
Enter fullscreen mode Exit fullscreen mode

3. Create a .github folder

Clone your repository in your device using git clone [your repo's address].
like this git clone https://github.com/vito-mohagheghian/vito-mohagheghian.git

Image description

Make new a new folder named .github and inside of this, make a new folder named workflows, then create a new folder like this: blog-post-workflow.yml

Modify .yml file

Copy/Paste the code below and just replace your dev.to username with mine in feed_list.

name: Latest blog post workflow
on:
  schedule:
    # Runs every hour
    - cron: '0 * * * *'
  workflow_dispatch:

jobs:
  update-readme-with-blog:
    name: Update this repo's README with the latest blog posts
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: gautamkrishnar/blog-post-workflow@v1
        with:
          max_post_count: "3"
          remove_duplicates: true
          feed_list: "https://dev.to/feed/vitomohagheghian"
Enter fullscreen mode Exit fullscreen mode

You can also change max_post_count and remove_duplicates values.

Push Changes to github

push changes you made with the following commands.

git add .
Enter fullscreen mode Exit fullscreen mode
git commit -m "add workflows"
Enter fullscreen mode Exit fullscreen mode
git push
Enter fullscreen mode Exit fullscreen mode

Run Github Actions

Now go to your GitHub repository, and go to the Actions tab.

Image description

You will see your workflow below 'all workflows', then click on Run workflow, and run it.

Congratulation 🎓, You have your own auto Github blog posts updater 🦄.

Keep in touch

Keep Coding Y'All 👨🏻‍💻

Top comments (0)