Skip to content

Commit 94f8697

Browse files
committed
Add the pre-commit hooks from the docs-spec-template repository
This will ensure consistent line endings and valid yaml/json. Can be enabled using `pre-commit install`.
1 parent fa4f576 commit 94f8697

File tree

2 files changed

+41
-0
lines changed

2 files changed

+41
-0
lines changed

.github/workflows/pre-commit.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
---
2+
name: pre-commit
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches: [main]
8+
9+
jobs:
10+
pre-commit:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- uses: actions/setup-python@v5
15+
- uses: pre-commit/[email protected]

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
---
2+
repos:
3+
- repo: https://github.com/pre-commit/pre-commit-hooks
4+
rev: v4.5.0
5+
hooks:
6+
- id: check-json
7+
- id: check-symlinks
8+
- id: check-yaml
9+
- id: end-of-file-fixer
10+
- id: trailing-whitespace
11+
args: [--markdown-linebreak-ext=md]
12+
13+
- repo: local
14+
hooks:
15+
- id: forbidden-file-extensions
16+
name: forbidden-file-extensions
17+
entry: disallow these file extensions
18+
language: fail
19+
# Disallow other asciidoc extensions except .adoc
20+
files: .*\.(asciidoc|asc)$
21+
22+
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
23+
rev: 0.2.3
24+
hooks:
25+
- id: yamlfmt
26+
args: [--mapping, '2', --sequence, '4', --offset, '2']

0 commit comments

Comments
 (0)