This GH action removes action runs from a repository. By default, obsolete workflow runs are deleted. Additional filter can be applied to deleted workflow runs by status/conclusion - see input parameters below for details.
Name | Description | Default | Optional |
---|---|---|---|
token |
The token used to authenticate | ${{ github.token }} |
true |
remove-obsolete |
Remove obsolete workflows | true |
true |
remove-cancelled |
Remove cancelled workflows | false |
true |
remove-failed |
Remove failed workflows | false |
true |
remove-skipped |
Remove skipped workflows | false |
true |
-
token
-
- Using
github.token
usually works, unless the actions are not scoped withrepo
rights. For more details, see theGITHUB_TOKEN
. - If the workflow has issues, you may need to use a personal access token (PAT) that must have the
repo
scope. More details, see "Creating a personal access token".
- Using
-
remove-obsolete
-
- All workflows that don't have a matching definition anymore will be deleted
-
remove-cancelled
-
- Remove workflows from the list that have been cancelled earlier
- Accepts either a boolean or a multiline
string
. Each line will be matched against the workflow'sname
. On match the run will be removed.
-
remove-failed
-
- Remove workflows from the list that have failed earlier
- Accepts either a boolean or a multiline
string
. Each line will be matched against the workflow'sname
. On match the run will be removed.
-
remove-skipped
-
- Remove workflows from the list that have been skipped earlier
- Accepts either a boolean or a multiline
string
. Each line will be matched against the workflow'sname
. On match the run will be removed.
name: Scheduled purge of failed workflow runs
on:
schedule:
- cron: '54 0 * * 0'
jobs:
purge_obsolete_workflows:
runs-on: ubuntu-latest
steps:
- uses: otto-de/purge-deprecated-workflow-runs@v2
with:
remove-obsolete: false
remove-failed: true
The example below will trigger a run of this workflow each time a deployment status changes.
All runs until success
will be skipped and then cleaned up in the success
case:
name: Manage Deployments
on:
deployment_status:
jobs:
clean_unfinished_deployment_status_tasks:
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'success'
steps:
- uses: otto-de/purge-deprecated-workflow-runs@v2
with:
# disable default-behaviour of deleting orphaned runs
remove-obsolete: false
# remove previously cancelled runs of *all* workflows
remove-cancelled: true
# remove failed runs of *this* workflow
remove-failed: |
${{ github.workflow }}
# remove previously skipped runs of workflows with given names
remove-skipped: |
Unit Tests
Deploy