Problem
The action currently runs Lake commands (build, lint, mathlib cache) and saves the cache during its own execution, before any user-defined steps run. This means artifacts produced by subsequent steps (the user's own lake build, tests, etc.) are never cached.
Users who set build: false and run their own commands get no benefit from the cache — every CI run rebuilds from scratch.
Precedent: Gradle Actions
gradle/actions had the exact same problem. The original action ran Gradle commands and cached before user steps. They redesigned it into setup-gradle:
- Setup step: Install Gradle + restore cache
- Post step: Save cache (after all user steps complete)
This ensures the cache always reflects the final build state.
Proposal
The action's core responsibilities should be:
- Setup step: Install the Lean toolchain + restore cache
- Post step: Save cache after all user steps have run
Everything else — lake build, lake lint — should be the user's own workflow steps.
- uses: leanprover/lean-action@v2
with:
lake-package-directory: packages
# User controls what runs
- run: make build
- run: make lint
- run: make test
# Post step (automatic): lean-action saves the cache
Problem
The action currently runs Lake commands (build, lint, mathlib cache) and saves the cache during its own execution, before any user-defined steps run. This means artifacts produced by subsequent steps (the user's own
lake build, tests, etc.) are never cached.Users who set
build: falseand run their own commands get no benefit from the cache — every CI run rebuilds from scratch.Precedent: Gradle Actions
gradle/actionshad the exact same problem. The original action ran Gradle commands and cached before user steps. They redesigned it intosetup-gradle:This ensures the cache always reflects the final build state.
Proposal
The action's core responsibilities should be:
Everything else —
lake build,lake lint— should be the user's own workflow steps.