From 84153b785bcaaa1d923b234d2cdd4172a65dea4c Mon Sep 17 00:00:00 2001 From: Roman Grinovski Date: Fri, 8 Sep 2023 15:17:56 +0200 Subject: [PATCH] Add cron job to sync supporters (#56) * test sync-supporters job * add missing GH_TOKEN * use github-push-action * revert github-push-action * simplify * delete-branch: true * change committer to bot * try adding author * actions/checkout@v4 * use peter-evans/create-pull-request@v5 * another tweak * equal author and committer * set author and committer to github-actions[bot] * schedule cron * remove on push --- .github/workflows/sync-supporters.yml | 38 +++++++++++++++++++++++++++ package.json | 3 ++- 2 files changed, 40 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/sync-supporters.yml diff --git a/.github/workflows/sync-supporters.yml b/.github/workflows/sync-supporters.yml new file mode 100644 index 00000000..ec17bd25 --- /dev/null +++ b/.github/workflows/sync-supporters.yml @@ -0,0 +1,38 @@ +name: Sync supporters + +on: + schedule: + - cron: "0 7 * * *" # Runs daily at 7:00 UTC + +jobs: + updateSupporters: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + with: + ref: main + + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: "18" + + - name: Install dependencies + run: npm ci + + - name: Run npm script + run: npm run sync-supporters + + - name: Create/Update Pull Request + uses: peter-evans/create-pull-request@v3 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: Update supporters + author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> + title: "[Auto PR] Update supporters" + body: "Supporters list has been updated." + branch: github-action/update-supporters + delete-branch: true diff --git a/package.json b/package.json index f74bfc05..9f71cb23 100644 --- a/package.json +++ b/package.json @@ -12,7 +12,8 @@ "serve": "docusaurus serve", "write-translations": "docusaurus write-translations", "write-heading-ids": "docusaurus write-heading-ids", - "typecheck": "tsc" + "typecheck": "tsc", + "sync-supporters": "node ./sync-supporters.js" }, "dependencies": { "@docusaurus/core": "2.4.1",