forked from mpv-player/mpv
-
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.
- Loading branch information
Showing
2 changed files
with
64 additions
and
0 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,42 @@ | ||
name: Cleanup caches | ||
|
||
on: | ||
workflow_run: | ||
workflows: [build] | ||
types: [completed] | ||
|
||
jobs: | ||
cache: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
gh extension install actions/gh-actions-cache | ||
# gh actions-cache list -L 100 -R ${{ github.repository }} --sort last-used --order desc | ||
# keys=$(gh actions-cache list -L 100 -R ${{ github.repository }} -B $BRANCH --sort last-used --order desc | cut -f 1) | ||
# set +e | ||
# echo $BRANCH | ||
# echo $keys | ||
# for key in "${keys[@]:1}" | ||
# do | ||
# echo $key | ||
# gh actions-cache delete $key -R ${{ github.repository }} -B $BRANCH --confirm | ||
# done | ||
caches=$(gh actions-cache list -L 100 --json key,ref --sort last_accessed_at --order desc) | ||
echo "$caches" | ||
echo "$caches" | jq -r ' | ||
group_by(.ref) | | ||
map({ | ||
ref: .[0].ref, | ||
caches: (.[1:] | map("- \(.key)")) | ||
}) | | ||
.[] | | ||
if (.caches | length) > 0 then | ||
"Caches for ref \(.ref) except the latest one:\n\(.caches | join("\n"))" | ||
else | ||
"No caches found for ref \(.ref) or only one cache exists." | ||
end | ||
' | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: ${{ github.event.workflow_run.head_branch }} |
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,22 @@ | ||
name: Cleanup caches PR | ||
|
||
on: | ||
pull_request_target: | ||
types: closed | ||
|
||
jobs: | ||
pr_cache: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- run: | | ||
gh extension install actions/gh-actions-cache | ||
set +e | ||
keys=$(gh actions-cache list -R ${{ github.repository }} -B $BRANCH | cut -f 1) | ||
set +e | ||
for key in $keys | ||
do | ||
gh actions-cache delete $key -R ${{ github.repository }} -B $BRANCH --confirm | ||
done | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge |