You're viewing an older version of this GitHub Action. Do you want to see the latest version instead?
GitHub Action
SlackFeedBot
v1.2.3
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, where:rss
is an RSS feed URL.slack_webhook
is the URL of your Slack webhook (this can and probably should be a repository or organization secret).cache_dir
is the folder in which you want to cache RSS data to prevent publishing duplicates (e.g.,~/slackfeedbot
), or alternately...interval
is 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
tells Slack to show the Open Graph preview. If set tofalse
the title, date, short description, and a link to the feed item will be posted. Defaults tofalse
because it's kind of flaky.
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 }}
- name: NYT
uses: 'selfagency/feedbot@v1.2.3'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
cache_dir: '~/slackfeedbot'
No cache, but maybe duplicates.
name: SlackFeedBot
on:
schedule:
- cron: '*/15 * * * *'
jobs:
rss-to-slack:
runs-on: ubuntu-latest
steps:
- name: NYT
uses: 'selfagency/feedbot@v1.2.3'
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: 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 }}
- name: NYT
uses: 'selfagency/feedbot@v1.2.3'
with:
rss: 'https://rss.nytimes.com/services/xml/rss/nyt/HomePage.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
cache_dir: '~/slackfeedbot'
unfurl: true
name: FeedBot
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 }}
- name: LAT
uses: 'selfagency/feedbot@v1.2.3'
with:
rss: 'https://www.latimes.com/rss2.0.xml'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
cache_dir: '~/slackfeedbot'
- name: WaPo
uses: 'selfagency/feedbot@v1.2.3'
with:
rss: 'https://feeds.washingtonpost.com/rss/homepage'
slack_webhook: ${{ secrets.SLACK_WEBHOOK }}
cache_dir: '~/slackfeedbot'