# Blog post workflow [](https://github.com/gautamkrishnar/blog-post-workflow/actions?query=workflow%3A%22Build+and+test%22)
[](#contributors-)

## How to use
1. Star this repo 😉
2. Go to your repository
3. Add the following section to your **README.md** file, you can give whatever title you want. Just make sure that you use `` in your readme. The workflow will replace this comment with the actual blog post list:
```markdown
# Blog posts
```
4. Create a folder named `.github` and create a `workflows` folder inside it, if it doesn't exist.
5. Create a new file named `blog-post-workflow.yml` with the following contents inside the workflows folder:
```yaml
name: Latest blog post workflow
on:
schedule: # Run workflow automatically
- cron: '0 0 * * *' # Runs once a day at 00:00 UTC
workflow_dispatch: # Run workflow manually (without waiting for the cron to be called), through the GitHub Actions Workflow page directly
permissions:
contents: write # To write the generated contents to the readme
jobs:
update-readme-with-blog:
name: Update this repo's README with latest blog posts
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Pull in dev.to posts
uses: gautamkrishnar/blog-post-workflow@v1
with:
feed_list: "https://dev.to/feed/gautamkrishnar,https://www.gautamkrishnar.com/feed/"
```
6. Replace the above URL list with your own RSS feed URLs. See [popular-sources](#popular-sources) for a list of common RSS feed urls. Commit the changes.
> **Note on workflow frequency:** The default schedule above runs once daily at 00:00 UTC, which is suitable for most users. You can adjust the schedule based on how frequently you publish content:
> - **Daily**: `cron: '0 0 * * *'` (recommended for most users)
> - **Weekly**: `cron: '0 0 * * 0'` (every Sunday at 00:00 UTC)
> - **Monthly**: `cron: '0 0 1 * *'` (1st day of every month at 00:00 UTC)
>
> Running the workflow too frequently (e.g., hourly) may be unnecessary unless you publish content very often. You can always trigger the workflow manually using `workflow_dispatch` whenever needed.
7. Go to repository settings, Click on Actions > General. Update the "Workflow permissions" to "Read and write permissions". Click on save.

8. Wait for it to run automatically, or you can also trigger it manually to see the result instantly. To trigger the workflow manually, please follow the steps in the [video](https://www.youtube.com/watch?v=ECuqb5Tv9qI&t=272s).
## Options
This workflow has additional options that you can use to customize it for your use case. The following are the list of options available:
| Option | Default Value | Description | Required |
|---------------------------|------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------|
| `feed_list` | `""` | Comma-separated list of RSS feed urls, eg: `https://example1.com,https://example2.com` | Yes |
| `max_post_count` | `5` | Maximum number of posts you want to show on your readme, all feeds combined | No |
| `readme_path` | `./README.md` | Comma separated paths of the readme files you want to update | No |
| `gh_token` | your GitHub token with repo scope | Use this to configure the token of the user that commits the workflow result to GitHub | No |
| `comment_tag_name` | `BLOG-POST-LIST` | Allows you to override the default comment tag name (``), if you want to show multiple instances of the action on the same repo, see advanced usage for more info | No |
| `disable_sort` | `false` | Disables the sorting of the list based on publish date | No |
| `sort_order` | `desc` | Specifies the sort order of posts when date sorting is enabled (`disable_sort` is `false`). Supports `asc` (ascending, oldest first) and `desc` (descending, newest first). Has no effect if `disable_sort` is `true`. Works even without `pubDate` in RSS feeds (items without dates are placed at the end). | No |
| `reverse_order` | `false` | Reverses the order of posts when `disable_sort` is set to `true` | No |
| `feed_names` | `""` | Comma-separated list of RSS feed names, this is intended to be used with `template` option. eg: `Blog,Dev.to` | No |
| `template` | `default` | Allows you to change the structure of the posts list by using different variables. By default this workflow uses markdown list format to render the posts, you can override this behavior using this option. Eg: `[$title]($url) ` will give you a space-separated list of posts.
**Supported variables**
$category ` will show category list as `category1` `category2` `category3` etc | No |
| `date_format` | `UTC:ddd mmm dd yyyy h:MM TT` | Allows you to change the format of the date or time displayed when using the $date in the template option. This uses NPM dateformat library, please read the library [documentation](https://www.npmjs.com/package/dateformat#named-formats) for the supported formats | No |
| `user_agent` | `rss-parser` | Allows you to customize the user agent used by the RSS feed crawler | No |
| `accept_header` | `application/rss+xml` | Allows you to customize the accept header of the http requests | No |
| `tag_post_pre_newline` | `true` if you are not using **template** option | Allows you to insert a newline before the closing tag and after the opening tag when using the template option if needed, for better formatting | No |
| `filter_comments` | `stackoverflow/Comment by $author/,stackexchange/Comment by $author/` | Comma separated list of platforms you want to enable the comment filter.| Title | Link |
|---|
![]() | $newline$title $date |
- Thanks **Greptile** for sponsoring AI code reviews: