|
8 | 8 | runs-on: ubuntu-latest |
9 | 9 | steps: |
10 | 10 | - uses: actions/checkout@v3 |
11 | | - - uses: asdf-vm/actions/install@v4 |
12 | | - - uses: pre-commit/action@v3.0.1 |
| 11 | + |
| 12 | + # --- 1. ASDF Caching and Installation --- |
| 13 | + - name: 💾 Cache ASDF Tool Versions |
| 14 | + uses: actions/cache@v4 |
| 15 | + id: cache-asdf |
| 16 | + with: |
| 17 | + # Cache the directory where asdf installs tools |
| 18 | + path: ~/.asdf/installs |
| 19 | + # Key is based on OS and the content of .tool-versions |
| 20 | + key: ${{ runner.os }}-asdf-${{ hashFiles('.tool-versions') }} |
| 21 | + restore-keys: | |
| 22 | + ${{ runner.os }}-asdf- |
| 23 | +
|
| 24 | + # Setup asdf itself (it's fast) |
| 25 | + - name: ⚙️ Setup ASDF |
| 26 | + uses: asdf-vm/actions/setup@v1 |
| 27 | + |
| 28 | + # Install runtimes (only downloads if not restored by cache) |
| 29 | + - name: 🔨 Install ASDF Runtimes |
| 30 | + uses: asdf-vm/actions/install@v4 |
| 31 | + |
| 32 | + # --- 2. Pre-commit Caching and Execution --- |
| 33 | + - name: 💾 Cache Pre-commit Hooks |
| 34 | + uses: actions/cache@v4 |
| 35 | + with: |
| 36 | + # Cache the directory where pre-commit installs its environments |
| 37 | + path: ~/.cache/pre-commit |
| 38 | + # Key is based on OS and the content of the pre-commit config |
| 39 | + key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }} |
| 40 | + restore-keys: | |
| 41 | + ${{ runner.os }}-pre-commit- |
| 42 | +
|
| 43 | + # Run pre-commit (will use cached environments if available) |
| 44 | + - name: ✅ Run pre-commit hooks |
| 45 | + uses: pre-commit/action@v3.0.1 |
| 46 | + # It's generally not necessary to pass GITHUB_TOKEN to pre-commit/action |
| 47 | + # unless one of your hooks specifically needs it for network access. |
| 48 | + # If it's not needed by a hook, you can remove the 'env' block. |
13 | 49 | env: |
14 | 50 | GITHUB_TOKEN: ${{ secrets.RELEASE_PLEASE_PAT }} |
0 commit comments