Skip to content

Conversation

@sjhddh
Copy link
Contributor

@sjhddh sjhddh commented Jan 23, 2026

Summary

  • Add cache: 'pip' to speed up pip dependency installation
  • Add actions/cache for ~/.cache/pre-commit to cache pre-commit hook environments
  • Cache key is based on .pre-commit-config.yaml hash for proper invalidation

Test Plan

  • Run the pre-commit workflow on a test PR
  • Verify cache is created on first run (check logs for "Cache saved")
  • Verify cache is restored on subsequent runs (check logs for "Cache restored")
  • Confirm workflow time decreases by ~30-60 seconds on cache hits

Risk

  • Low risk: caching is a standard CI practice
  • Rollback: remove the cache steps if issues occur
  • No functional changes to the workflow

@gemini-code-assist
Copy link
Contributor

Note

Gemini is unable to generate a review for this pull request due to the file types involved not being currently supported.

@mergify mergify bot added the ci/build label Jan 23, 2026
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

- uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: ~/.cache/pre-commit
key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-commit cache key missing Python version

Low Severity

The pre-commit cache key pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} doesn't include the Python version. Pre-commit creates Python-version-specific virtualenvs for each hook. If python-version is later changed from "3.12" to another version, the cached environments built for 3.12 could cause cryptic failures when hooks try to run with an incompatible interpreter.

Fix in Cursor Fix in Web

Add caching for both pip packages and pre-commit hook environments to
significantly reduce workflow execution time:
- pip cache: reduces Python dependency installation time
- pre-commit cache: avoids re-downloading hook repositories on each run

Expected savings: ~30-60 seconds per workflow run on cache hits.

Signed-off-by: 7. Sun <jhao.sun@gmail.com>
@sjhddh sjhddh force-pushed the ci/cache-pre-commit branch from f6284fb to 7917d8e Compare January 23, 2026 23:24
Signed-off-by: 7. Sun <jhao.sun@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant