# Fetch the feeds in feeds.json every hour with rss2json.py and publish the # JSON to GitHub Pages, so the Tableau REST API Connector can read it from # https://.github.io//all.json # # On GitHub this file must live at .github/workflows/rss.yml (see README, step B4). # Needs: Settings → Pages → Build and deployment → Source = "GitHub Actions" — set that # BEFORE adding this file, otherwise the first run fails with "Get Pages site failed". name: RSS to JSON on GitHub Pages on: schedule: - cron: "42 * * * *" # hourly, at :17 (GitHub may run it a few minutes late) workflow_dispatch: # "Run workflow" button in the Actions tab push: branches: [main] # republish when feeds.json changes permissions: contents: read pages: write id-token: write concurrency: group: pages cancel-in-progress: false jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.12" - id: pages uses: actions/configure-pages@v6 # Seed out/ with the currently published files, so that a feed which # returns 0 items this hour keeps last hour's items instead of going empty. - name: Download previously published JSON run: | mkdir -p out for slug in $(python3 -c 'import json; print(*[f["slug"] for f in json.load(open("feeds.json"))["feeds"]])'); do curl -sfL "${{ steps.pages.outputs.base_url }}/$slug.json" -o "out/$slug.json" || rm -f "out/$slug.json" done ls out | wc -l - name: Fetch feeds run: python3 rss2json.py -f feeds.json - name: Write a small index.html listing the files run: | cd out { echo 'RSS as JSON' echo '

RSS as JSON for Tableau

' echo '

Tableau REST API Connector: Response Format JSON, JSON Path $.items[*]

Generated $(date -u '+%Y-%m-%d %H:%M UTC')

" } > index.html - uses: actions/upload-pages-artifact@v5 with: path: out deploy: needs: build runs-on: ubuntu-latest environment: name: github-pages url: ${{ steps.deployment.outputs.page_url }} steps: - id: deployment uses: actions/deploy-pages@v5