-
-
Notifications
You must be signed in to change notification settings - Fork 48
49 lines (42 loc) · 1.45 KB
/
lint.yaml
File metadata and controls
49 lines (42 loc) · 1.45 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
45
46
47
48
49
on:
workflow_call:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
env:
PRE_COMMIT_HOME: ${{ github.workspace }}/.cache/pre-commit-cache
PIP_DISABLE_PIP_VERSION_CHECK: 1
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Python
id: python
uses: actions/setup-python@v6
with:
python-version: "3.11"
cache: pip
cache-dependency-path: requirements/lint.pip
- name: Install Python dependencies
run: pip install -U -r requirements/lint.pip
- name: Pre-commit environment cache
uses: actions/cache@v4
with:
path: ${{ env.PRE_COMMIT_HOME }}
key: "precommit-0-${{ runner.os }}-${{ env.PRE_COMMIT_HOME }}-\
${{ steps.python.outputs.python-version }}-\
${{ hashFiles('./.pre-commit-config.yaml') }}"
# Skip the flake8 hook because the following command will run it.
- name: Run pre-commit hooks
id: run-pre-commit-hooks
run: |
SKIP=flake8 pre-commit run --all-files
pre-commit run --all-files --hook-stage manual flake8-annotate
# Show the log to debug failures.
- name: Show pre-commit log
if: always() && steps.run-pre-commit-hooks.outcome == 'failure'
run: |
set -eu
if [ -f "${PRE_COMMIT_HOME}/pre-commit.log" ]; then
cat "${PRE_COMMIT_HOME}/pre-commit.log"
fi