leanprover / leanprover/lean-action

Adopt setup + post-step cache pattern (don't run commands in the action)

Open
#154 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Shell
Stars
45
Forks
22
Avg merge
4d 15h
Merged PRs (30d)
1

Description

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:

  1. Setup step: Install the Lean toolchain + restore cache
  2. 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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the action's current setup, Lean command execution, and cache restore/save flow. Separate setup and post-step responsibilities so user-defined build, lint, and test steps run before cache saving; done means the action restores during setup and saves the final state afterward without running those commands itself.

Written by the indexing model from the issue text.

Assessment

Tech stack
github-actions, shell
Domain
ci-cd, devops
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.