From 1033655615ce4a8c14a0d25c8c2ebdc77022596c Mon Sep 17 00:00:00 2001 From: James Cole Date: Thu, 23 Feb 2023 07:03:47 +0100 Subject: [PATCH] Update prune workflow. --- .github/workflows/cleanup.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/cleanup.yml b/.github/workflows/cleanup.yml index 36e1d755cc..f4dd45ce17 100644 --- a/.github/workflows/cleanup.yml +++ b/.github/workflows/cleanup.yml @@ -12,18 +12,18 @@ jobs: timeout-minutes: 10 steps: - name: Prune cancelled/skipped runs - uses: actions/github-script@v4 + uses: actions/github-script@v6 with: github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }} script: | - const cancelled = await github.actions.listWorkflowRunsForRepo({ + const cancelled = await github.rest.actions.listWorkflowRunsForRepo({ owner: context.repo.owner, per_page: 100, repo: context.repo.repo, status: 'cancelled', }); - const skipped = await github.actions.listWorkflowRunsForRepo({ + const skipped = await github.rest.actions.listWorkflowRunsForRepo({ owner: context.repo.owner, per_page: 100, repo: context.repo.repo, @@ -33,7 +33,7 @@ jobs: for (const response of [cancelled, skipped]) { for (const run of response.data.workflow_runs) { console.log(`Run id ${run.id} of '${run.name}' is a cancelled/skipped run. Deleting...`); - await github.actions.deleteWorkflowRun({ + await github.rest.actions.deleteWorkflowRun({ owner: context.repo.owner, repo: context.repo.repo, run_id: run.id @@ -42,7 +42,7 @@ jobs: } - name: Prune runs older than 3 days - uses: actions/github-script@v4 + uses: actions/github-script@v6 with: github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }} script: | @@ -67,7 +67,7 @@ jobs: for (const workflow of workflows) { for (let page = 0; page < pages; page += 1) { - let response = await github.actions.listWorkflowRuns({ + let response = await github.rest.actions.listWorkflowRuns({ owner: context.repo.owner, page: page, per_page: 100, @@ -88,7 +88,7 @@ jobs: for (const run of runs_to_delete) { console.log(`Run id ${run[0]} of '${run[1]}' is older than ${days_to_expiration} days. Deleting...`); try { - await github.actions.deleteWorkflowRun({ + await github.rest.actions.deleteWorkflowRun({ owner: context.repo.owner, repo: context.repo.repo, run_id: run[0]