Skip to content

Commit e02ec7e

Browse files
committed
CI: further improve caching
1 parent 75f9684 commit e02ec7e

3 files changed

Lines changed: 14 additions & 15 deletions

File tree

.github/delete-cache.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#!/bin/sh
2+
test "$1" || { echo "Usage: delete-cache.sh cache-key"; exit 1; }
3+
gh api --method DELETE \
4+
-H "Accept: application/vnd.github+json" \
5+
"/repos/scijava/pom-scijava/actions/caches?key=$1" || true

.github/workflows/build.yml

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,16 @@ jobs:
5555
uses: actions/cache/restore@v4
5656
with:
5757
path: ~/.cache/pombast
58-
key: ${{ runner.os }}-pombast-cache
58+
key: ${{ runner.os }}-pombast-build
5959

6060
- name: Run pombast melt+smelt commands
6161
run: .github/melt.sh
6262
shell: bash
6363

6464
- name: Delete old pombast cache
6565
if: always()
66-
run: |
67-
gh api --method DELETE \
68-
-H "Accept: application/vnd.github+json" \
69-
"/repos/scijava/pom-scijava/actions/caches?key=${{ runner.os }}-pombast-cache" || true
66+
run: .github/delete-cache.sh "${{ runner.os }}-pombast-build"
67+
shell: bash
7068
env:
7169
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7270

@@ -75,7 +73,7 @@ jobs:
7573
uses: actions/cache/save@v4
7674
with:
7775
path: ~/.cache/pombast
78-
key: ${{ runner.os }}-pombast-cache
76+
key: ${{ runner.os }}-pombast-build
7977

8078
- name: Publish smelt results
8179
if: always() && github.ref == 'refs/heads/master' && github.event_name == 'push'

.github/workflows/status.yml

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@ jobs:
2828
with:
2929
path: ~/.cache/pombast
3030
key: ${{ runner.os }}-pombast-status
31-
restore-keys: ${{ runner.os }}-pombast-cache
3231

32+
# The monoqueue library is used by pombast to read GitHub issues.
3333
- name: Restore monoqueue cache
3434
uses: actions/cache/restore@v4
3535
with:
@@ -44,10 +44,8 @@ jobs:
4444

4545
- name: Delete old pombast status cache
4646
if: always()
47-
run: |
48-
gh api --method DELETE \
49-
-H "Accept: application/vnd.github+json" \
50-
"/repos/scijava/pom-scijava/actions/caches?key=${{ runner.os }}-pombast-status" || true
47+
run: .github/delete-cache.sh "${{ runner.os }}-pombast-status"
48+
shell: bash
5149
env:
5250
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5351

@@ -60,10 +58,8 @@ jobs:
6058

6159
- name: Delete old monoqueue cache
6260
if: always()
63-
run: |
64-
gh api --method DELETE \
65-
-H "Accept: application/vnd.github+json" \
66-
"/repos/scijava/pom-scijava/actions/caches?key=${{ runner.os }}-monoqueue-status" || true
61+
run: .github/delete-cache.sh "${{ runner.os }}-monoqueue-status"
62+
shell: bash
6763
env:
6864
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6965

0 commit comments

Comments
 (0)