Skip to content

Linger is An Open-Source Personal Agent That Runs Fully on Your PC. We aim to break Big Tech’s grip on AI by bringing powerful local AI to everyday computers through efficient model–harness co-design, so everyone can run their own.

ci: keep only the Go build cache entries a main push used

shoudi zheng99bedaae6322
diff --git a/.github/actions/check/action.yml b/.github/actions/check/action.yml
index 22d4227a..e1b96eb5 100644
--- a/.github/actions/check/action.yml
+++ b/.github/actions/check/action.yml
@@ -26,9 +26,8 @@ runs:
# which need the pinned Node but no workspace packages.
# Each Go check keeps its own build and module cache, so one job's save
# never replaces another's. Pull requests and merge-queue builds restore
- # main's latest entry; only pushes to main save. Go trims build cache
- # entries unused for five days, so the restored cache does not grow
- # without bound.
+ # main's latest entry; only pushes to main save, and a successful push
+ # keeps only the build cache entries its own run used.
- id: plan
shell: bash
env:
@@ -68,6 +67,16 @@ runs:
restore-keys: |
${{ steps.plan.outputs.prefix }}
${{ steps.plan.outputs.app_prefix }}
+ # Go refreshes an entry's mtime on use only when it is over an hour old, so
+ # backdating everything makes the entries this run uses the only recent
+ # ones. The cache is content-addressed: pruning can only cause misses,
+ # never wrong results.
+ - if: github.event_name == 'push' && steps.plan.outputs.is_go == 'true'
+ shell: bash
+ run: |
+ if [ -d ~/.cache/go-build ]; then
+ find ~/.cache/go-build -type f -exec touch -m -d '2 hours ago' {} +
+ fi
# Pinned golangci-lint and sqlc binaries; building them takes about 60 s
# each. Their file names carry the tool and Go versions, and the key
# hashes the files that pin both, so a version bump misses and rebuilds.
@@ -90,6 +99,13 @@ runs:
env:
APP: ${{ inputs.app }}
run: make "check-$APP" BASE="$BASE"
+ # A failed run saves unpruned; the next successful push prunes.
+ - if: success() && github.event_name == 'push' && steps.plan.outputs.is_go == 'true'
+ shell: bash
+ run: |
+ if [ -d ~/.cache/go-build ]; then
+ find ~/.cache/go-build -type f -mmin +60 -delete
+ fi
- uses: actions/cache/save@v4
if: always() && github.event_name == 'push' && inputs.app == 'teamhub'
with: