-
Notifications
You must be signed in to change notification settings - Fork 23
44 lines (37 loc) · 1.26 KB
/
create_cache.yml
File metadata and controls
44 lines (37 loc) · 1.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: "Create GHA cache"
# GitHub puts the following restrictions on cache sharing. PRs can access
#
# - caches that were created by the PR / earlier runs of the PR
# - caches that were created on the target branch
#
# To get effective cache sharing between PRs, we create caches on the `develop`
# branch (which is where almost all PRs merge into).
on:
push:
branches: [develop]
# Cancel running jobs if there's a newer push
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# GitHub Actions cache of the pre-commit environment
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Setup Python 3.12
uses: actions/setup-python@v6
with:
python-version: '3.12'
- uses: actions/cache@v5
id: cache
with:
path: ~/.cache/pre-commit
key: pre-commit_${{ env.pythonLocation }}_${{ hashFiles('.pre-commit-config.yaml') }}
lookup-only: true # don't actually download the cache
- name: Populate pre-commit environment (if not cached)
if: steps.cache.outputs.cache-hit != 'true'
run: |
pip install pre-commit
pre-commit install --install-hooks