armbian-build/.github/workflows/cleanup-workflow-logs.yml
Igor 78c7556e7e
CI: Add watchdog action script and adjust log cleaning parameter (#9147)
* CI: add watchdog action script and adjust log cleaning parameter

- Replace hardcoded GH_TOKEN env with granular permissions
- Add proper error handling for workflow/run lookups
- Fix duplicate condition checking "failure" twice
- Only rerun failed workflows, exclude cancelled ones
- Improve jq parsing with cleaner variable extraction
- Add debug logging for troubleshooting
- Use dynamic repository reference for portability
2025-12-31 13:58:46 +01:00

28 lines
711 B
YAML

name: Clean workflow logs
on:
schedule:
- cron: "0 0 * * 1" # Runs "At 00:00 on Monday." (see https://crontab.guru)
workflow_dispatch:
inputs:
runs_older_than:
description: "The amount of days old to delete"
default: "10"
required: false
env:
SCHEDULED_RUNS_OLDER_THAN: "10"
SCHEDULED_RUNS_TO_KEEP: "0"
jobs:
clean-logs:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- uses: igorjs/gh-actions-clean-workflow@v7
with:
runs_older_than: ${{ github.event.inputs.runs_older_than || env.SCHEDULED_RUNS_OLDER_THAN }}
runs_to_keep: ${{ github.event.inputs.runs_to_keep || env.SCHEDULED_RUNS_TO_KEEP }}