Skip to content

Instantly share code, notes, and snippets.

@ADTC
Created March 27, 2023 08:00

Revisions

  1. ADTC created this gist Mar 27, 2023.
    35 changes: 35 additions & 0 deletions Clean workflow runs.yml
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,35 @@
    name: Clean workflow runs
    on:
    workflow_dispatch:
    schedule:
    - cron: '0 0 * * *'
    # Run at 00:00 everyday. See https://crontab.guru to change.

    jobs:

    del_workflow_runs:
    runs-on: ubuntu-latest
    steps:

    # This cleans skipped workflow runs.
    - name: Delete skipped workflow runs
    uses: Mattraks/delete-workflow-runs@v2
    with:
    token: ${{ github.token }}
    repository: ${{ github.repository }}
    retain_days: 0
    keep_minimum_runs: 0
    delete_run_by_conclusion_pattern: skipped
    # dry_run: true

    # This cleans all runs previously generated by this workflow.
    # `delete_workflow_pattern` must match the name on line 1.
    - name: Delete previous runs of this file
    uses: Mattraks/delete-workflow-runs@v2
    with:
    token: ${{ github.token }}
    repository: ${{ github.repository }}
    retain_days: 0
    keep_minimum_runs: 0
    delete_workflow_pattern: Clean workflow runs
    # dry_run: true