Better workflow for prune.

This commit is contained in:
James Cole
2024-02-04 06:39:55 +01:00
parent 40196d48b2
commit 94730e998b

View File

@@ -2,6 +2,9 @@
name: "Chore - Prune old builds"
permissions:
actions: write
on:
schedule:
- cron: '0 0 * * *'
@@ -14,7 +17,7 @@ jobs:
- name: Prune cancelled/skipped runs
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const cancelled = await github.rest.actions.listWorkflowRunsForRepo({
owner: context.repo.owner,
@@ -44,7 +47,7 @@ jobs:
- name: Prune runs older than 3 days
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GH_ACTIONS_PERSONAL_ACCESS_TOKEN }}
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const days_to_expiration = 3;
const ms_in_day = 86400000;