# Delete old nightly and weekly prereleases and their tags. Stable v* releases are never touched. name: Prune Prereleases "on": workflow_run: workflows: ["Release"] types: [completed] schedule: - cron: "30 7 * * 1" # Mondays 07:30 UTC workflow_dispatch: inputs: keep: description: "Releases to keep per channel (nightly, weekly)" default: "3" apply: description: "Delete (false = dry run)" type: boolean default: false permissions: {} concurrency: group: prune-prereleases cancel-in-progress: false jobs: prune: # A failed release must not prune the last good nightly; Homebrew's yams-nightly points at it. if: >- github.repository == 'trvon/yams' && (github.event_name != 'workflow_run' || github.event.workflow_run.conclusion == 'success') runs-on: ubuntu-24.04 timeout-minutes: 10 permissions: contents: write steps: - name: Checkout main-owned tooling uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: ref: ${{ github.workflow_sha }} fetch-depth: 1 persist-credentials: false submodules: false - name: Prune env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} KEEP: ${{ inputs.keep || '3' }} APPLY: ${{ github.event_name != 'workflow_dispatch' || inputs.apply }} run: | set -euo pipefail args=(--keep "$KEEP") if [ "$APPLY" = "true" ]; then args+=(--apply); fi python3 scripts/ci/prune_prereleases.py "${args[@]}" | tee -a "$GITHUB_STEP_SUMMARY"