Skip to content

Sync latest Remote Ruby episode #46

Sync latest Remote Ruby episode

Sync latest Remote Ruby episode #46

name: Sync latest Remote Ruby episode
on:
schedule: [{ cron: "0 13 * * *" }]
workflow_dispatch:
# Only the latest run proceeds; cancel any older in-flight run.
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
permissions:
contents: write
jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with: { node-version: "22" }
- run: corepack enable && pnpm install --frozen-lockfile
- name: Fetch latest episode from Buzzsprout
env:
BUZZSPROUT_API_TOKEN: ${{ secrets.BUZZSPROUT_API_TOKEN }}
run: |
set -euo pipefail
curl -fsSL \
-H "Authorization: Token token=\"$BUZZSPROUT_API_TOKEN\"" \
https://www.buzzsprout.com/api/2260490/episodes.json \
> /tmp/episodes.json
node .github/scripts/parse-remote-ruby.mjs /tmp/episodes.json > /tmp/remote_ruby.json
- name: Validate shape
run: |
set -euo pipefail
# Required keys for the homepage + speaking page renderers. If
# Buzzsprout changes their API, fail loud instead of writing a half
# object that breaks the build downstream.
jq -e '.id and .title and .url and .published_at' /tmp/remote_ruby.json > /dev/null \
|| { echo "::error::remote_ruby.json missing required keys"; exit 1; }
mv /tmp/remote_ruby.json src/_data/remote_ruby.json
- name: Commit changes if any
run: |
if ! git diff --quiet src/_data/remote_ruby.json; then
git config user.name "andrewmcodes-bot"
git config user.email "bot@andrewm.codes"
git add src/_data/remote_ruby.json
git commit -m "chore(data): refresh latest Remote Ruby episode"
git push
fi