Skip to content

fix(deps): update androidx.glance to v1.2.0 #311

fix(deps): update androidx.glance to v1.2.0

fix(deps): update androidx.glance to v1.2.0 #311

name: Gradle Cache Cleanup
on:
pull_request:
types:
- closed
workflow_dispatch:
inputs:
branch:
description: 'Branch to target for cleanup'
required: false
default: 'develop'
allCaches:
description: 'Delete all caches across the repo (true/false). When true, branch input is ignored.'
required: false
default: 'false'
jobs:
gradle-cache-cleanup:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v7
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
TARGET_BRANCH="${{ github.event.inputs.branch }}"
ALL_CACHES="${{ github.event.inputs.allCaches }}"
# Set default branch value
DEFAULT_BRANCH="develop"
# Set default branch if not provided (for PR close events)
if [ -z "$TARGET_BRANCH" ]; then
TARGET_BRANCH="$DEFAULT_BRANCH"
fi
echo "Fetching list of cache keys"
if [ "$ALL_CACHES" = "true" ]; then
echo "Listing all caches across the repository"
cacheKeys=$(gh actions-cache list -R $REPO | cut -f1)
else
echo "Listing caches for branch: refs/heads/$TARGET_BRANCH"
cacheKeys=$(gh actions-cache list -R $REPO -B "refs/heads/$TARGET_BRANCH" | cut -f1)
fi
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeys
do
if [ "$ALL_CACHES" = "true" ]; then
gh actions-cache delete $cacheKey -R $REPO --confirm
else
gh actions-cache delete $cacheKey -R $REPO -B "refs/heads/$TARGET_BRANCH" --confirm
fi
echo "$cacheKey"
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}