Skip to content

Commit 87ee06c

Browse files
committed
Better staticcheck cache
Cache doesn't seem to work at all now? Since every build seems to take ~10 mins, even repeated ones on the same PR. Since the cache is quite large (~1.5G), store it just on the master branch, and then restore it from there for every PR. That should be "good enough".
1 parent 0962458 commit 87ee06c

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

.github/workflows/staticcheck.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
steps:
1414
# Setup
1515
- uses: 'actions/checkout@v6'
16+
17+
# Store and restore staticcheck only from master branch.
1618
- id: 'cache-restore'
1719
uses: 'actions/cache/restore@v5'
1820
with:
@@ -21,8 +23,7 @@ jobs:
2123
${{ runner.temp }}/staticcheck
2224
/home/runner/.cache/go-build
2325
restore-keys: |
24-
staticcheck-${{ github.ref }}
25-
staticcheck-refs/heads/main
26+
staticcheck
2627
- uses: 'actions/setup-go@v6'
2728
with: {go-version: 'stable'}
2829
- uses: 'actions/cache@v5'
@@ -53,9 +54,9 @@ jobs:
5354
done
5455
exit $fail
5556
56-
# Store cache
57+
# Store cache, only on master branch
5758
- name: 'delete existing cache'
58-
if: '${{ steps.cache-restore.outputs.cache-hit }}'
59+
if: "github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'"
5960
env: {GH_TOKEN: '${{ secrets.GITHUB_TOKEN }}'}
6061
continue-on-error: true
6162
run: |

0 commit comments

Comments
 (0)