Sync Soro RSS #16
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Sync Soro RSS | |
| on: | |
| schedule: | |
| # Daily 14:00 UTC — after typical morning Soro publishes | |
| - cron: "0 14 * * *" | |
| workflow_dispatch: | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: sync-soro-rss | |
| cancel-in-progress: true | |
| jobs: | |
| sync: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| # Persist credentials so we can push back to main | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Heroku rejects shallow clones ("shallow update not allowed"). | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| cache: "pnpm" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Sync Soro RSS into content/articles | |
| run: pnpm --filter simple-table-marketing run sync-soro-rss | |
| - name: Commit and push if changed | |
| id: commit | |
| run: | | |
| set -euo pipefail | |
| git config user.name "github-actions[bot]" | |
| git config user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
| git add apps/marketing/content/articles | |
| if git diff --staged --quiet; then | |
| echo "No article changes to commit." | |
| echo "changed=false" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| git commit -m "content(articles): sync Soro RSS" | |
| git push | |
| echo "changed=true" >> "$GITHUB_OUTPUT" | |
| # GITHUB_TOKEN pushes do not trigger other workflows, so deploy here. | |
| - name: Deploy marketing to Heroku | |
| if: steps.commit.outputs.changed == 'true' | |
| env: | |
| HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
| HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }} | |
| HEROKU_GIT_BRANCH: ${{ vars.HEROKU_GIT_BRANCH }} | |
| run: | | |
| set -euo pipefail | |
| if [ -z "${HEROKU_API_KEY:-}" ] || [ -z "${HEROKU_APP_NAME:-}" ]; then | |
| echo "::error title=Heroku::HEROKU_API_KEY / HEROKU_APP_NAME secrets are required to deploy synced articles." | |
| exit 1 | |
| fi | |
| BRANCH="${HEROKU_GIT_BRANCH:-main}" | |
| git remote remove heroku 2>/dev/null || true | |
| git remote add heroku "https://heroku:${HEROKU_API_KEY}@git.heroku.com/${HEROKU_APP_NAME}.git" | |
| git push -f heroku "HEAD:refs/heads/${BRANCH}" |