forked from beeware/.github
-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (51 loc) · 1.64 KB
/
pre-commit-run.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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Pre-commit Checks
#######
# Runs the repository's pre-commit hooks.
#######
on:
workflow_call:
inputs:
python-version:
description: "Python version to use; defaults to latest Python release."
default: "3.X"
type: string
repository:
description: "GitHub repository to checkout; defaults to repo running this workflow."
default: ${{ github.repository }}
type: string
pre-commit-source:
description: "The arguments for `pip install` to install pre-commit; use ./path/to/package[dev] for the repo's pinned version."
default: ".[dev]"
type: string
runner-os:
description: "Runner OS to use to run pre-commit; defaults to ubuntu-latest"
default: "ubuntu-latest"
type: string
defaults:
run:
shell: bash
jobs:
pre-commit:
name: Pre-commit Checks
runs-on: ${{ inputs.runner-os }}
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/[email protected]
with:
repository: ${{ inputs.repository }}
- name: Set up Python
uses: actions/[email protected]
with:
python-version: ${{ inputs.python-version }}
- name: Cache pre-commit
uses: actions/[email protected]
with:
path: ~/.cache/pre-commit
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}
- name: Update pip
run: python -m pip install -U pip
- name: Install pre-commit
run: python -m pip install ${{ inputs.pre-commit-source }}
- name: Run pre-commit
run: pre-commit run --show-diff-on-failure --color=always --all-files