File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4747 shell : bash
4848 run : pnpm store prune
4949
50+ # Cache keys are immutable, so every save creates a brand-new entry
51+ # instead of replacing the previous one — old pnpm-store entries for main
52+ # never get evicted by anything but GitHub's 10GB LRU quota. Delete them
53+ # here so main only ever carries the one store it actually needs.
54+ - name : Delete stale pnpm store caches
55+ if : github.ref == 'refs/heads/main' && inputs.save-cache == 'true'
56+ shell : bash
57+ env :
58+ GH_TOKEN : ${{ github.token }}
59+ run : |
60+ cacheIds=$(gh cache list --repo "${{ github.repository }}" --ref refs/heads/main --key "pnpm-store-${{ runner.os }}-" --limit 100 --json id --jq '.[].id')
61+ for id in $cacheIds; do
62+ echo "Deleting stale pnpm store cache $id"
63+ gh cache delete "$id" --repo "${{ github.repository }}" || true
64+ done
65+
5066 # Only main writes new cache entries — PRs restore-and-reuse but never
5167 # save, so open PRs stop each spawning their own throwaway ~700MB entry.
5268 - name : Save pnpm store
Original file line number Diff line number Diff line change 2626 packages : write # Required for publishing to npm registry
2727 id-token : write # Required for OIDC token generation
2828 pull-requests : write # Required for changesets action to create PRs
29+ actions : write # Required to delete stale pnpm-store caches
2930 outputs :
3031 published : ${{ steps.changesets.outputs.published }}
3132 has-changesets : ${{ steps.changesets.outputs.has-changesets }}
You can’t perform that action at this time.
0 commit comments