-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hoist GH cache clearing into reusable action
Signed-off-by: Hanno Becker <[email protected]>
- Loading branch information
1 parent
a2a9ead
commit 0fce70e
Showing
2 changed files
with
37 additions
and
14 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,31 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
name: Clear GitHub cache entries | ||
description: Removes entries from GitHub cache by key | ||
|
||
inputs: | ||
key_prefix: | ||
description: Fixed prefix of ID of Github cache entries that should be removed. | ||
required: true | ||
repository: | ||
description: Name of the repository | ||
required: true | ||
gh_token: | ||
description: Github access token to use | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
steps: | ||
- name: List and remove cache entries | ||
shell: bash | ||
run: | | ||
cache_keys=$(gh cache list -R ${{ env.REPO }} -k ${{ inputs.key_prefix }} | cut -f 1) | ||
echo "Deleting nix-installer caches..." | ||
for key in $cache_keys | ||
do | ||
gh cache -R ${{ env.REPO }} delete $key || echo "Could not remove $key" | ||
done | ||
env: | ||
GH_TOKEN: ${{ inputs.gh_token }} | ||
REPO: ${{ inputs.repository }} |
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