Repository navigation
feat: versioned (CAS) user writes in basic lock script #478
Workflow file for this run
This file contains hidden or 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: "Ops: Cache Cleanup" | |
| on: | |
| pull_request: | |
| types: | |
| - closed | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| cleanup: | |
| permissions: | |
| actions: write # to delete PR caches via gh cache delete | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Harden Runner | |
| uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0 | |
| with: | |
| egress-policy: audit | |
| - name: Cleanup | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| REPO: ${{ github.repository }} | |
| PR_NUMBER: ${{ github.event.pull_request.number }} | |
| run: | | |
| BRANCH="refs/pull/${PR_NUMBER}/merge" | |
| echo "Fetching list of cache keys" | |
| cacheKeysForPR=$(gh cache list -R "$REPO" --ref "$BRANCH" | cut -f 1) | |
| set +e | |
| echo "Deleting caches..." | |
| for cacheKey in $cacheKeysForPR | |
| do | |
| gh cache delete "$cacheKey" -R "$REPO" | |
| done | |
| echo "Done" |