Skip to content

Commit 7f6cb04

Browse files
committed
Add workflow to delete caches on closed PRs
- evict cache files that untouched during the job run - remove 6.8 workflow (6.9 should be sufficient) - see #301
1 parent 57688f5 commit 7f6cb04

File tree

3 files changed

+34
-1
lines changed

3 files changed

+34
-1
lines changed

.github/workflows/build.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
uses: hendrikmuhs/[email protected]
5656
with:
5757
key: ${{ runner.os }}-ubuntu-${{ matrix.container_version }}
58+
evict-old-files: 'job'
5859

5960
- name: Build PythonQt
6061
run: |
@@ -214,6 +215,7 @@ jobs:
214215
uses: hendrikmuhs/[email protected]
215216
with:
216217
key: ${{ runner.os }}-${{ matrix.qt-version }}
218+
evict-old-files: 'job'
217219

218220
- name: Detect exact versions
219221
id : versions

.github/workflows/build_latest.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: ['ubuntu', 'windows']
23-
qt-version: [ '5.12.*', '5.15.*', '6.8.*', '6.9.*' ]
23+
qt-version: [ '5.12.*', '5.15.*', '6.9.*' ]
2424
python-version: [ '3.12' ]
2525
runs-on: ${{ matrix.os }}-latest
2626
steps:
@@ -50,6 +50,7 @@ jobs:
5050
uses: hendrikmuhs/[email protected]
5151
with:
5252
key: ${{ runner.os }}-${{ matrix.qt-version }}
53+
evict-old-files: 'job'
5354
if: ${{ matrix.os == 'ubuntu' }}
5455

5556
- name: Set environment

.github/workflows/clean_caches.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Cleanup caches on closed pull requests
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
7+
jobs:
8+
cleanup:
9+
runs-on: ubuntu-latest
10+
permissions:
11+
actions: write
12+
contens: read
13+
steps:
14+
- name: Cleanup caches
15+
run: |
16+
echo "Fetching list of cache keys"
17+
cacheKeysForPR=$(gh cache list --ref $BRANCH --limit 100 --json id --jq '.[].id')
18+
19+
## Setting this to not fail the workflow while deleting cache keys.
20+
set +e
21+
echo "Deleting caches..."
22+
for cacheKey in $cacheKeysForPR
23+
do
24+
gh cache delete $cacheKey
25+
done
26+
echo "Done"
27+
env:
28+
GH_TOKEN: ${{ github.token }}
29+
GH_REPO: ${{ github.repository }}
30+
BRANCH: refs/pull/${{ github.event.pull_request.number }}/merge

0 commit comments

Comments
 (0)