-
Notifications
You must be signed in to change notification settings - Fork 247
Clear Cache Workflow
James Garriss edited this page Dec 13, 2024
·
1 revision
This page contains a workflow that is no longer in use. Since we might need it again someday, I have moved it here for easy reference.
# Purpose: The purpose of this workflow is to delete all caches for a specific run.
name: Clear Caches
on:
workflow_call:
workflow_dispatch:
jobs:
cleanup:
name: Clear Cache
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
# Run even if one of the functional tests have failed
# We always want to clean up the caches that we create
if: always()
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
cacheKeys=$(gh actions-cache list -R $REPO)
set +e
for cacheKey in $cacheKeys
do
if [[ $cacheKey == scubagear-directory-${{ github.run_id }} ]] ||[[ $cacheKey == powershell-directory-${{ github.run_id }} ]] || [[ $cacheKey == opa-directory-${{ github.run_id }} ]]
then
echo "Deleting" $cacheKey
gh actions-cache delete $cacheKey --confirm
fi
done
env:
GH_TOKEN: ${{ github.token }}
REPO: ${{ github.repository }}