forked from R3BRootGroup/R3BRoot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cache with os tag and auto chache clean-up
- Loading branch information
Showing
5 changed files
with
67 additions
and
64 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: cache-clean | ||
description: 'steps to clean the old caches before creating new ones' | ||
|
||
inputs: | ||
GH_TOKEN: | ||
description: 'Github token for the cache cleaning' | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: Debug gh CLI | ||
run: | | ||
gh --version | ||
gh auth status | ||
gh extension list | ||
shell: bash | ||
|
||
- name: Update GitHub CLI | ||
run: sudo apt-get install gh | ||
shell: bash | ||
|
||
- name: Install and Verify gh-actions-cache Extension | ||
run: | | ||
gh extension install actions/gh-actions-cache || exit 1 | ||
gh extension list | grep gh-actions-cache || (echo "Extension installation failed" && exit 1) | ||
shell: bash | ||
|
||
- name: Test actions-cache list | ||
run: | | ||
gh actions-cache list -R R3BRootGroup/R3BRoot -L 5 || echo "Failed to list caches" | ||
shell: bash | ||
|
||
- name: Cleanup | ||
run: | | ||
echo "Fetching list of cache keys" | ||
cacheKeys=$(gh actions-cache list -R R3BRootGroup/R3BRoot -L 100 | cut -f 1 | grep -v 'build-deps') || exit 1 | ||
set +e | ||
echo "Deleting old caches..." | ||
for cacheKey in $cacheKeys | ||
do | ||
gh actions-cache delete $cacheKey -R R3BRootGroup/R3BRoot --confirm || echo "Failed to delete $cacheKey" | ||
done | ||
echo "Done" | ||
shell: bash | ||
env: | ||
GH_TOKEN: ${{ inputs.GH_TOKEN }} |
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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