-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathaction.yml
40 lines (34 loc) · 1.17 KB
/
action.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
34
35
36
37
38
39
40
name: 'Python linting'
description: 'Run Python linting using pre-commit'
runs:
using: "composite"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: set PY
shell: bash
run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
- name: Cache pre-commit install
uses: actions/cache@v4
with:
path: |
${{ env.pythonLocation }}
~/.cache/pre-commit
key: |
pre-commit-${{ env.PY }}-${{ hashFiles('.pre-commit-config.yaml') }}
- name: Install dependencies
shell: bash
run: pip install pre-commit
- name: Install pre-commit hooks
shell: bash
run: pre-commit install
# This will run on all files in the repo not just those that have been
# committed. Once formatting has been applied once globally, from then on
# the files being changed by pre-commit should be just those that are
# being committed - provided that people are using the pre-commit hook to
# format their code.
- name: run pre-commit
shell: bash
run: pre-commit run --all-files --color always