GitHub Action
SlackFeedBot
v1.2.9
Latest version
Push RSS feed updates to Slack via GitHub Actions
- Add the Incoming Webhooks app to your Slack workspace if you haven't already.
- Create a new webhook by clicking the
Add to Slack
button. - Customize the webhook however you like, then copy the webhook URL.
- Create a new workflow in your desired repository (e.g.
.github/workflows/slackfeedbot.yml
) and drop in the follwing:
name: SlackFeedBot
on:
schedule:
- cron: '*/15 * * * *'
jobs:
rss-to-slack:
runs-on: ubuntu-latest
steps:
- name: NYT
uses: 'selfagency/[email protected]'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
interval: 15
Required fields denoted with *
. Must specify cache_dir
(which requires separate use of actions/cache or a similar solution) or interval
.
rss
*: The RSS feed URL.feed_name
: A title to override the RSS feed's own title.feed_image
: An image to override the RSS feed's default feed image.slack_webhook
*: The Slack webhook URL (this can and probably should be a repository or organization secret).cache_dir
*: The folder in which to cache feed data, which prevents publishing duplicates, or alternately...interval
*: The number of minutes between runs of the parent workflow, as specified in thecron
section of theschedule
workflow trigger (may publish duplicates due to post pinning).unfurl
: Shows the Open Graph preview for RSS items instead of this action's display format. Set tofalse
because it's kind of flaky and non-customizable. Use the below settings instead to customize display.show_desc
: Show the post description. Defaults totrue
.show_img
: Show the post image. Defaults totrue
.show_date
: Show the post date. Defaults totrue
.show_link
: Show the Read more link, linking back to the post. Defaults totrue
.
Hashes and caches the post title + creation date to ensure no duplicates are posted.
name: SlackFeedBot
on:
schedule:
- cron: '*/15 * * * *'
jobs:
rss-to-slack:
runs-on: ubuntu-latest
steps:
- name: Generate cache key
uses: actions/github-script@v6
id: generate-key
with:
script: |
core.setOutput('cache-key', new Date().valueOf())
- name: Retrieve cache
uses: actions/cache@v2
with:
path: ./slackfeedbot-cache
key: feed-cache-${{ steps.generate-key.outputs.cache-key }}
restore-keys: feed-cache-
- name: NYT
uses: 'selfagency/[email protected]'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
cache_dir: './slackfeedbot-cache'
No cache, but maybe duplicates.
name: SlackFeedBot
on:
schedule:
- cron: '*/15 * * * *'
jobs:
rss-to-slack:
runs-on: ubuntu-latest
steps:
- name: NYT
uses: 'selfagency/[email protected]'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
interval: 15
name: FeedBot
on:
schedule:
- cron: '*/15 * * * *'
jobs:
rss-to-slack:
runs-on: ubuntu-latest
steps:
- name: LAT
uses: 'selfagency/[email protected]'
with:
rss: 'https://www.latimes.com/rss2.0.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
interval: 15
- name: WaPo
uses: 'selfagency/[email protected]'
with:
rss: 'https://feeds.washingtonpost.com/rss/homepage'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
interval: 15