From a02a8ee40b9e95858326b360a17122085778da45 Mon Sep 17 00:00:00 2001 From: jackett-bot <63515285+jackett-bot@users.noreply.github.com> Date: Tue, 23 Jan 2024 15:29:31 +1300 Subject: [PATCH] Create issue-bot-redeliver.yml --- .github/workflows/issue-bot-redeliver.yml | 52 +++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 .github/workflows/issue-bot-redeliver.yml diff --git a/.github/workflows/issue-bot-redeliver.yml b/.github/workflows/issue-bot-redeliver.yml new file mode 100644 index 000000000..e045e4a68 --- /dev/null +++ b/.github/workflows/issue-bot-redeliver.yml @@ -0,0 +1,52 @@ +# +name: Redeliver failed webhook deliveries + +# This workflow runs every 3 hours or when manually triggered. +on: + schedule: + - cron: '20 */3 * * *' + workflow_dispatch: + +# This workflow will use the built in `GITHUB_TOKEN` to check out the repository contents. This grants `GITHUB_TOKEN` permission to do that. +permissions: + contents: read + +# +jobs: + redeliver-failed-deliveries: + name: Redeliver failed deliveries + runs-on: ubuntu-latest + steps: + # This workflow will run a script that is stored in the repository. This step checks out the repository contents so that the workflow can access the script. + - name: Check out repo content + uses: actions/checkout@v4 + + # This step sets up Node.js. The script that this workflow will run uses Node.js. + - name: Setup Node.js + uses: actions/setup-node@v3 + with: + node-version: '18.x' + + # This step installs the octokit library. The script that this workflow will run uses the octokit library. + - name: Install dependencies + run: npm install octokit + + # This step sets some environment variables, then runs a script to find and redeliver failed webhook deliveries. + # - Replace `YOUR_SECRET_NAME` with the name of the secret where you stored your personal access token. + # - Replace `YOUR_REPO_OWNER` with the owner of the repository where the webhook was created. + # - Replace `YOUR_REPO_NAME` with the name of the repository where the webhook was created. + # - Replace `YOUR_HOOK_ID` with the ID of the webhook. + # - Replace `YOUR_LAST_REDELIVERY_VARIABLE_NAME` with the name that you want to use for a configuration variable that will be stored in the repository where this workflow is stored. The name can be any string that contains only alphanumeric characters and `_`, and does not start with `GITHUB_` or a number. For more information, see "[AUTOTITLE](/actions/learn-github-actions/variables#defining-configuration-variables-for-multiple-workflows)." + + - name: Run script + env: + TOKEN: ${{ secrets.ISSUEBOT }} + REPO_OWNER: 'Jackett' + REPO_NAME: 'Jackett' + HOOK_ID: '24748032' + LAST_REDELIVERY_VARIABLE_NAME: 'ISSUEBOT_WEBHOOK_REDELIVER' + + WORKFLOW_REPO_NAME: ${{ github.event.repository.name }} + WORKFLOW_REPO_OWNER: ${{ github.repository_owner }} + run: | + node .github/workflows/scripts/redeliver-failed-deliveries.js