From f3359cb43d8913fb2d2c34709369dcaac5bf7651 Mon Sep 17 00:00:00 2001 From: Zagrios <40181755+Zagrios@users.noreply.github.com> Date: Sun, 31 Aug 2025 21:03:38 +0200 Subject: [PATCH] Add update patreon workflow --- .github/workflows/update-patreons.yml | 48 +++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 .github/workflows/update-patreons.yml diff --git a/.github/workflows/update-patreons.yml b/.github/workflows/update-patreons.yml new file mode 100644 index 00000000..831779c7 --- /dev/null +++ b/.github/workflows/update-patreons.yml @@ -0,0 +1,48 @@ +name: Update Patreon supporters + +on: + schedule: + - cron: "0 0 * * *" # Every day at 00:00 UTC + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-patreons: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + persist-credentials: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: "22" + cache: "npm" + + - name: Install dependencies + run: npm ci + + - name: Run Patreon update script + env: + PATREON_ACCESS_TOKEN: ${{ secrets.PATREON_ACCESS_TOKEN }} + PATREON_CAMPAIGN_ID: ${{ secrets.PATREON_CAMPAIGN_ID }} + PATREON_USER_AGENT: BSManager - Patreon Sync (GitHub Action) + run: npx ts-node ./.erb/scripts/update-patreon.js + + - name: Commit and push changes if any + run: | + if [[ -n $(git status --porcelain assets/jsons/patreons.json) ]]; then + git config user.name "GitHub Action" + git config user.email "action@github.com" + git add assets/jsons/patreons.json + git commit -m "chore(patreon): update patreons.json [skip ci]" + git push + else + echo "No changes to commit." + fi + +