-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
23 lines (21 loc) · 814 Bytes
/
action.yml
File metadata and controls
23 lines (21 loc) · 814 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
name: "Delete GitHub Actions cache"
description: "Delete GitHub Actions cache"
branding:
icon: "delete"
color: "gray-dark"
runs:
using: "composite"
steps:
- shell: bash
run: |
gh extension install actions/gh-actions-cache
mergedPRNumbers=$(gh pr list --state merged --json number | jq -r '.[].number')
for prNumber in $mergedPRNumbers
do
gh actions-cache list -L 100 -B refs/pull/$prNumber/merge | cut -f 1 | xargs -I{} gh actions-cache delete --confirm {}
done
closedPRNumbers=$(gh pr list --state closed --json number | jq -r '.[].number')
for prNumber in $closedPRNumbers
do
gh actions-cache list -L 100 -B refs/pull/$prNumber/merge | cut -f 1 | xargs -I{} gh actions-cache delete --confirm {}
done