Skip to content

Commit

Permalink
fuck_this_shit
Browse files Browse the repository at this point in the history
  • Loading branch information
kasper93 committed May 19, 2024
1 parent 2c68e6c commit 9f294a2
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 0 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/cleanup_caches.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
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
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
BRANCH: ${{ github.event.workflow_run.head_branch }}
22 changes: 22 additions & 0 deletions .github/workflows/cleanup_caches_pr.yml
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

0 comments on commit 9f294a2

Please sign in to comment.