Skip to content

Commit

Permalink
Fix pre-commit GitHub Action cache (#4746)
Browse files Browse the repository at this point in the history
Currently pre-commit caching seems not to work properly: There is
no cache stored according to GitHub Action tab, and the Prepare
Python dependencies job shows the following warning:
Warning: Path Validation Error: Path(s) specified in the action for caching do(es) not exist, hence no cache is being saved.

This seems to be similar to what have been observed and solved in
Home Assistant Core with home-assistant/core#46696.
Use PRE_COMMIT_CACHE instead of PRE_COMMIT_HOME as well.
  • Loading branch information
agners authored Dec 6, 2023
1 parent d63f0d5 commit 8c8122e
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:

env:
DEFAULT_PYTHON: "3.11"
PRE_COMMIT_HOME: ~/.cache/pre-commit
PRE_COMMIT_CACHE: ~/.cache/pre-commit

concurrency:
group: "${{ github.workflow }}-${{ github.ref }}"
Expand Down Expand Up @@ -49,7 +49,8 @@ jobs:
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_HOME }}
path: ${{ env.PRE_COMMIT_CACHE }}
lookup-only: true
key: |
${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
Expand Down Expand Up @@ -132,7 +133,7 @@ jobs:
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_HOME }}
path: ${{ env.PRE_COMMIT_CACHE }}
key: |
${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Fail job if cache restore failed
Expand Down Expand Up @@ -208,7 +209,7 @@ jobs:
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_HOME }}
path: ${{ env.PRE_COMMIT_CACHE }}
key: |
${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Fail job if cache restore failed
Expand Down Expand Up @@ -249,7 +250,7 @@ jobs:
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_HOME }}
path: ${{ env.PRE_COMMIT_CACHE }}
key: |
${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Fail job if cache restore failed
Expand Down Expand Up @@ -325,7 +326,7 @@ jobs:
id: cache-precommit
uses: actions/[email protected]
with:
path: ${{ env.PRE_COMMIT_HOME }}
path: ${{ env.PRE_COMMIT_CACHE }}
key: |
${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Fail job if cache restore failed
Expand Down

0 comments on commit 8c8122e

Please sign in to comment.