Compare commits

...
Author SHA1 Message Date
Blake Friedman bdd60661b7 [RN][CI] enable gradle action cleanup + closed Prs
Enable `gradle-home-cache-cleanup` to attempt to limit the growth of the
`gradle-home-v1-*` cache entries. When these entries grow too large bad
things happen. See [1].

Added cleanup-pr-cache to remove cache entries created by a PR, when the
PR is closed.

[1] https://github.com/gradle/actions/blob/main/docs/setup-gradle.md#remove-unused-files-from-gradle-user-home-before-saving-to-the-cache

Changelog: [Internal]
2024-06-19 10:19:39 +01:00
2 changed files with 34 additions and 0 deletions
+4
View File
@@ -7,3 +7,7 @@ runs:
uses: gradle/actions/setup-gradle@v3
with:
gradle-version: wrapper
# The gradle-home-v1 cache entry grows very, eventually failing the jobs
# when extracted.
gradle-home-cache-cleanup: true
+30
View File
@@ -0,0 +1,30 @@
# From: https://docs.github.com/en/actions/using-workflows/caching-dependencies-to-speed-up-workflows#force-deleting-cache-entries
name: cleanup caches by a branch that was closed
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
steps:
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH -L 100 | 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 }}
REPO: ${{ github.repository }}
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge