Removes old GitHub Actions runs to keep your repository clean.
You are advised to run this action with the dry-run option first to see what will be deleted.
When you are ready to use this, you can schedule it to check periodically.
WARNING: Deletion cannot be undone. Use at your own risk.
This action used to live under the yanovation org and was listed on the Marketplace as
Delete Old GitHub Actions Runs. That listing is now deprecated.
If you're coming from there, just replace the uses: string with yanovian/prune-old-actions@v1 — everything else (inputs, behavior) stays the same, no other changes needed.
on:
schedule:
- cron: '0 0 * * *' # Specify your own schedule
workflow_dispatch: # Allows manual runs from the Actions tab
permissions:
actions: write # Required to delete workflow runs
contents: read
jobs:
prune-old-actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: yanovian/prune-old-actions@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
days-ago: 30Or you can test with dry-run option:
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
actions: write
contents: read
jobs:
prune-old-actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: yanovian/prune-old-actions@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
days-ago: 30
dry-run: trueYou can also keep the last N runs (N = 5 in this example):
on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
permissions:
actions: write
contents: read
jobs:
prune-old-actions:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
- uses: yanovian/prune-old-actions@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
days-ago: 30
dry-run: true
keep-latest: 5token: The GitHub token to use for authentication. (required)days-ago: The number of days ago to delete the runs. (required)dry-run: If set to true, the Action will only list the runs to be deleted without actually deleting them. (optional, default: false, meaning it will delete the runs)keep-latest: The number of latest runs to keep. (optional, default: 0, meaning this option is disabled)
For the token, you can just use the {{ secrets.GITHUB_TOKEN }} which is a default secret that GitHub provides to each
run. You can read more about
it here.
Deleting a workflow run needs write access to Actions (API docs).
In the workflow itself, grant that with:
permissions:
actions: write
contents: readIf the repository (or org) default for GITHUB_TOKEN is still Read repository contents and packages permissions,
raise it to Read and write so the job can request actions: write:

You can read more about it here. This is the easiest way, especially if you have multiple repositories within multiple organizations and have access to update this setting, but gives too much access to the token.
Alternatively, you can authenticate with a GitHub App (needs more setup):
...
steps:
- name: Generate a token
id: generate-token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ vars.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: yanovian/prune-old-actions@v1
with:
token: ${{ steps.generate-token.outputs.token }}
days-ago: 30You can read more about it here.
Also, another option is to create a Personal Access Token (PAT). Make sure to give the token the least needed access.