Skip to content

ikawaha/feedsnippet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Feed Snippet

The feedsnippet is a tool for displaying the latest feed snippet in README.md, and so on. It creates a markdown feed snippet from an RSS, ATOM, or JSON feeds and replace the old snippet with the new one. The format of the generated feed can be formatted using the text template.

Install

go install github.com/ikawaha/feedsnippet@latest

Config

Minimal configuration

- urls:
    - https://zenn.dev/ikawaha/feed
  limit: 5
- urls:
    - https://qiita.com/ikawaha/feed
  limit: 5

Outputs:

Listing multiple feeds

- urls:
    - https://zenn.dev/ikawaha/feed
  template: |-
    **Zenn**
    {{range . -}}
      * ![](./icon/zenn.png) [{{ .Title }}]({{ .Link }})
    {{ end }}
  limit: 5
- urls:
    - https://qiita.com/ikawaha/feed
  template: |-
    **Qiita**
    {{range . -}}
      * ![](./icon/qiita.png) [{{ .Title }}]({{ .Link }})
    {{ end }}
  limit: 5

Outputs:

Zenn

Qiita

Mixing multiple feeds

- urls:
    - https://zenn.dev/ikawaha/feed
    - https://qiita.com/ikawaha/feed
  template: |-
    {{range . -}}
      * {{ if eq .Header.FeedLink "https://zenn.dev/ikawaha/feed" -}}
            ![](./icon/zenn.png)
        {{- else }}{{ if eq .Header.FeedLink "https://qiita.com/ikawaha/feed" -}}
            ![](./icon/qiita.png)
        {{- end }}{{ end -}}
      [{{ .Title }}]({{ .Link }})
    {{ end }}
  limit: 10
  sort_by_published: true

Outputs:

Automatic update using github workflow

name: Update feed snippet

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0 * * *'

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3

      - name: Set up Go
        uses: actions/setup-go@v3
        with:
          go-version-file: 'stable'

      - name: Install feedsnippet
        run: go install github.com/ikawaha/feedsnippet@latest

      - name: Update README.md
        run: feedsnippet -config feedsnippet.yml -diff -file README.md

      - name: git commit
        run: |
          git config --local user.email "ikawaha@users.noreply.github.com"
          git config --local user.name "ikawaha"
          git add README.md
          git diff --cached --quiet || (git commit -m "Update feed snippet" && git push origin main)

Outputs:


MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages