diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml deleted file mode 100644 index ba84241..0000000 --- a/.github/workflows/main.yml +++ /dev/null @@ -1,35 +0,0 @@ -on: - push: - branches: - - main - - master - pull_request: - branches: - - main - - master - -name: Cleanup old runs - uses: actions/github-script@v4 - with: - github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }} - script: | - const days_to_expiration = 1; - const ms_in_day = 86400000; - const now = Date.now(); - - const response = await github.actions.listWorkflowRuns({ - owner: context.repo.owner, - repo: context.repo.repo, - workflow_id: 'test-coverage.yml' - }); - - for (const run of response.data.workflow_runs) { - if (now - Date.parse(run.created_at) > ms_in_day * days_to_expiration) { - console.log(`Run id ${run.id} is older than ${days_to_expiration} days. Deleting...`); - await github.actions.deleteWorkflowRun({ - owner: context.repo.owner, - repo: context.repo.repo, - run_id: run.id - }); - } - }