Skip to content

Prune Old Workflow Runs & Artifacts #10

Prune Old Workflow Runs & Artifacts

Prune Old Workflow Runs & Artifacts #10

name: Prune Old Workflow Runs & Artifacts
on:
schedule:
- cron: "0 0 * * 0" # Runs every Sunday at midnight UTC
workflow_dispatch: # Allows manual execution
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
steps:
- name: Delete workflow runs
uses: Mattraks/delete-workflow-runs@v2
with:
token: ${{ github.token }}
repository: ${{ github.repository }}
retain_days: 7
keep_minimum_runs: 1
- name: Delete old artifacts
uses: c-hive/gha-remove-artifacts@v1
with:
age: "7 days"
skip-recent: 1