Cleanup caches for closed PRs #158
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: Cleanup caches for closed PRs | |
on: | |
schedule: | |
- cron: "0 17 * * *" | |
workflow_dispatch: | |
jobs: | |
cleanup: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cleanup | |
run: | | |
gh extension install actions/gh-actions-cache | |
export REPO="${{ github.repository }}" | |
gh pr list --state closed -L 20 --json number --jq '.[]|.number' | ( | |
while IFS='$\n' read -r closed_pr; do | |
BRANCH="refs/pull/${closed_pr}/merge" ./cleanup-cache.sh | |
done | |
) | |
gh pr list --state closed -L 20 --json headRefName --jq '.[]|.headRefName' | ( | |
while IFS='$\n' read -r branch; do | |
BRANCH="$branch" ./cleanup-cache.sh | |
done | |
) | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |