Skip to content

Fetch RSS

Fetch RSS #153617

Workflow file for this run

name: "Fetch RSS"
on:
schedule:
- cron: "*/5 * * * *"
workflow_dispatch:
jobs:
fetch:
runs-on: ubuntu-latest
continue-on-error: true
strategy:
matrix:
rss_link: ["https://buttondown.email/denonews/rss", "https://deno.com/feed"]
steps:
- name: "[SETUP] Checkout Bot"
uses: actions/checkout@v3
with:
ref: bot
- name: "[SETUP] Deno"
uses: denoland/setup-deno@v1
with:
deno-version: vx.x.x
- name: "[SETUP] Dep Cache"
uses: actions/cache@v3
with:
path: |
~/.deno
~/.cache/deno
key: ${{ runner.os }}-deno-${{ hashFiles('**/deps.ts') }}
- name: "[Fetch] RSS Feed"
env:
BOT_ID: ${{ secrets.BOT_ID }}
BOT_TOKEN: ${{ secrets.BOT_TOKEN }}
CHANNEL_ID: ${{ secrets.CHANNEL_ID }}
RSS_LINK: ${{ matrix.rss_link }}
run: |
deno run -A --unstable https://raw.githubusercontent.com/${{ github.repository }}/dev/main.ts
- name: "[LOG] list"
run: ls -alR
- name: "[WRAPUP] Sanitize rss_link"
id: sanitize
run: |
output=$(echo ${{ matrix.rss_link }} | sed "s/:/_/g" | sed "s/\//_/g")
echo $output
echo "::set-output name=artifact-name::$output"
- name: "[WRAPUP] Upload last published time file"
uses: actions/upload-artifact@v4
with:
name: ${{ steps.sanitize.outputs.artifact-name }}.json
path: lastPublished/${{ steps.sanitize.outputs.artifact-name }}.json
publish:
runs-on: ubuntu-latest
needs: [fetch]
steps:
- name: "[SETUP] Checkout Bot"
uses: actions/checkout@v3
with:
ref: bot
- name: "[DOWNLOAD] Download last published time files"
uses: actions/download-artifact@v4
with:
path: lastPublished/
merge-multiple: true
- name: "[LOG] Show list"
run: ls -alR
- name: "[LOG] Show diff"
run: git diff
- name: "[WRAPUP] Write Last Published Time"
run: |
git config user.name "Deno RSS Bot"
git config user.email "deno-rss@example.com"
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
git add lastPublished/*.json
git commit -m "last_published updated" --allow-empty
git push