Skip to content

Commit cd68075

Browse files
authored
Make some pre-commit hooks manual (#263)
1 parent 762e242 commit cd68075

File tree

3 files changed

+27
-3
lines changed

3 files changed

+27
-3
lines changed

.github/workflows/tests.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ jobs:
4747
run: |
4848
codecov
4949
50+
pre-commit:
51+
name: Run pre-commit hook
52+
runs-on: ubuntu-latest
53+
timeout-minutes: 5
54+
steps:
55+
- name: Checkout
56+
uses: actions/checkout@v2
57+
- uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
58+
- name: Run pre-commit
59+
uses: pre-commit/[email protected]
60+
- name: Help message if pre-commit fail
61+
if: ${{ failure() }}
62+
run: |
63+
echo "You can install pre-commit hooks to automatically run formatting"
64+
echo "on each commit with:"
65+
echo " pre-commit install"
66+
echo "or you can run by hand on staged files with"
67+
echo " pre-commit run"
68+
echo "or after-the-fact on already committed files with"
69+
echo " pre-commit run --all-files --hook-stage=manual"
70+
5071
docs:
5172
name: Docs Build
5273
runs-on: ubuntu-latest

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
ci:
2-
skip: [check-jsonschema]
3-
41
repos:
52
- repo: https://github.com/pre-commit/pre-commit-hooks
63
rev: v4.1.0
@@ -48,6 +45,7 @@ repos:
4845
hooks:
4946
- id: doc8
5047
args: [--max-line-length=200]
48+
stages: [manual]
5149

5250
- repo: https://github.com/pycqa/flake8
5351
rev: 4.0.1
@@ -59,6 +57,7 @@ repos:
5957
"flake8-logging-format==0.6.0",
6058
"flake8-implicit-str-concat==0.2.0",
6159
]
60+
stages: [manual]
6261

6362
- repo: https://github.com/sirosen/check-jsonschema
6463
rev: 0.14.2
@@ -68,3 +67,4 @@ repos:
6867
files: ^\.github/workflows/
6968
types: [yaml]
7069
args: ["--schemafile", "https://json.schemastore.org/github-workflow"]
70+
stages: [manual]

CONTRIBUTING.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,6 @@ If you have already committed files before setting up the pre-commit
6262
hook with `pre-commit install`, you can fix everything up using
6363
`pre-commit run --all-files`. You need to make the fixing commit
6464
yourself after that.
65+
66+
Some of the hooks only run on CI by default, but you can invoke them by
67+
running with the `--hook-stage manual` argument.

0 commit comments

Comments
 (0)