-
Notifications
You must be signed in to change notification settings - Fork 335
33 lines (31 loc) · 1.03 KB
/
pre-commit.yml
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
name: lint with pre-commit
on:
pull_request:
push:
branches:
- main
tags:
- '*'
jobs:
pre-commit:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install pre-commit
run: |
source "${CONDA}/etc/profile.d/conda.sh"
# avoid future conflicts with base environment
conda create --name pre-commit -c conda-forge pre-commit
conda activate pre-commit
echo "versions='$(python --version)-$(pre-commit --version)'" | tee -a "${GITHUB_ENV}"
# inspired by https://github.com/pre-commit/action/blob/main/action.yml
- uses: actions/cache@v4
with:
path: ~/.cache/pre-commit
key: pre-commit|${{ env.versions }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Lint code with pre-commit
run: |
source "${CONDA}/etc/profile.d/conda.sh"
conda activate pre-commit
pre-commit run --verbose --all-files --show-diff-on-failure --color=always