Skip to content

Commit 8fa98b4

Browse files
Closes #265: Enable pre-commit (#273)
* Closes #265: Enable pre-commit * Clean up rendered docs after testing 'mkdocs build' * Omit Django checks for brevity
1 parent 33e4bc5 commit 8fa98b4

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

.hooks/mkdocs-build.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
echo "Running mkdocs build..."
5+
6+
TEMP_SITE_DIR=$(mktemp -d)
7+
8+
# Run mkdocs build into temp dir
9+
if mkdocs build --site-dir "$TEMP_SITE_DIR" --strict; then
10+
echo "Build successful."
11+
else
12+
echo "Build failed." >&2
13+
exit 1
14+
fi
15+
16+
# Cleanup
17+
rm -rf "$TEMP_SITE_DIR"

.pre-commit-config.yaml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
rev: v0.11.12
4+
hooks:
5+
- id: ruff
6+
name: "Ruff linter"
7+
args: [ netbox_branching/ ]
8+
- repo: local
9+
hooks:
10+
- id: mkdocs-build
11+
name: "Build documentation"
12+
description: "Build the documentation with mkdocs"
13+
files: 'docs/'
14+
entry: .hooks/mkdocs-build.sh
15+
language: system
16+
pass_filenames: false

0 commit comments

Comments
 (0)