name: Blog posts to readme
on:
  workflow_dispatch:
  schedule:
    - cron: '0 15 * * *'
jobs:
  pull_blog_rss:
    name: Update with latest blog posts
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - name: Get RSS Feed
        uses: kohrongying/readme-the-rss@master
        with:
          feed_url: https://coryd.dev/feeds/posts
          count: 5
      - name: Commit file changes
        run: |
            git config --global user.name 'cdransf'
            git config --global user.email 'hi@coryd.dev'
            git add .
            git diff --quiet --cached || git commit -m "Update README"
      - name: Push changes
        uses: ad-m/github-push-action@master
        with:
          github_token: ${{ secrets.GH_TOKEN }}
