Skip to content
Snippets Groups Projects
Unverified Commit 2e4472c6 authored by Luis Paolini's avatar Luis Paolini Committed by GitHub
Browse files

Clean cache after branch closes (#27505)


* Clean cache after branch closes

* Add whitespace

* Add whitespace

* Finalize caches cleanup workflow

---------

Co-authored-by: default avatarNemanja <31325167+nemanjaglumac@users.noreply.github.com>
parent 3637ecf4
No related branches found
No related tags found
No related merge requests found
name: Cleanup caches by a branch
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment