delete workflow runs #60
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: delete workflow runs | |
on: | |
schedule: | |
- cron: "20 4 * * 0" | |
workflow_dispatch: | |
inputs: | |
logLevel: | |
description: 'Log level' | |
required: true | |
default: 'warning' | |
type: choice | |
options: | |
- info | |
- warning | |
- debug | |
minimum_kept: | |
description: 'Minimum number per workflow to be kept.' | |
required: true | |
default: 2 | |
jobs: | |
delete-workflow-runs: | |
runs-on: ubuntu-latest | |
name: delete old workflow runs | |
permissions: | |
actions: write | |
contents: read | |
steps: | |
- name: Check out the codebase. | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.event.workflow_run.head_branch }} | |
- name: 🐍 set up python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.12" | |
- name: install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
- name: clean workflow | |
run: | | |
make \ | |
gh-clean | |
env: | |
GH_TOKEN: ${{ github.token }} | |
GH_KEEP_WORKFLOWS: ${{ github.event.inputs.minimum_kept }} |