File tree 3 files changed +47
-2
lines changed
3 files changed +47
-2
lines changed Original file line number Diff line number Diff line change 1
- name : Pull Requests
1
+ name : Check
2
2
3
3
on :
4
+ pull_request : # Check Pull Requests
5
+
4
6
push :
5
- pull_request :
7
+ branches :
8
+ - master # Check branch after merge
6
9
7
10
concurrency :
8
11
# Only run once for latest commit per ref and cancel other (previous) runs.
Original file line number Diff line number Diff line change
1
+ name : Delete Caches
2
+ on :
3
+ schedule :
4
+ - cron : " 0 */4 * * *" # Every 4th hour
5
+
6
+ concurrency :
7
+ # Only run once and cancel other (previous) runs.
8
+ group : delete-caches
9
+ cancel-in-progress : true
10
+
11
+ permissions :
12
+ actions : write # this permission is needed to delete cache
13
+
14
+ jobs :
15
+ delete-public-local-caches :
16
+ name : Delete unneeded caches
17
+ runs-on : ubuntu-latest
18
+ steps :
19
+ - uses : actions/checkout@v4
20
+ - run : |
21
+ gh cache list --limit 500 --order asc --sort last_accessed_at | grep 'play-published-local' > caches.txt || true
22
+ echo "Found $(wc -l < caches.txt | xargs) published local cache entries"
23
+
24
+ current_time=$(date -u +%s)
25
+ expiration_time=$((current_time - 7200)) # 2 hour ago
26
+
27
+ echo "Current time is $(date -d @$current_time)"
28
+ echo "All entries hadn't been use from $(date -d @$expiration_time) will be delete"
29
+
30
+ while IFS=$'\t' read -r id name size created_at last_accessed_at; do
31
+ accessedTimestamp=$(date -u -d "$last_accessed_at" +%s)
32
+ # Uncomment to check on Mac OS
33
+ # accessedTimestamp=$(date -j -f "%Y-%m-%dT%H:%M:%SZ" "$last_accessed_at" +%s)
34
+ if [ "$accessedTimestamp" -lt "$expiration_time" ]; then
35
+ echo "Delete $id $name ($last_accessed_at)"
36
+ gh cache delete $id
37
+ fi
38
+ done < caches.txt
39
+ rm -rf caches.txt
40
+ env:
41
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
42
+
File renamed without changes.
You can’t perform that action at this time.
0 commit comments