This is an automated email from the ASF dual-hosted git repository.
sebb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/whimsy.git
The following commit(s) were added to refs/heads/master by this push:
new 24fb8c91 [CI] Add pre-commit workflow with 10+ hooks (#294)
24fb8c91 is described below
commit 24fb8c910fa0d5baa4c7be785d7bb1739c568aa3
Author: John Bampton <[email protected]>
AuthorDate: Sat Mar 21 01:24:18 2026 +1000
[CI] Add pre-commit workflow with 10+ hooks (#294)
* [CI] Add pre-commit workflow with 10+ hooks
* Run pre-commit and auto clean up
https://github.com/pre-commit/pre-commit-hooks
10 basic checks added to enforce standards, quality an to stop regressions
This pre-commit config can be greatly expanded with many more checks in
future
Examples:
https://github.com/apache/sedona/blob/master/.github/workflows/pre-commit.yml
https://pre-commit.com/#github-actions-example
https://github.com/apache/shiro/blob/main/.github/workflows/pre-commit.yml
https://github.com/apache/sedona/blob/master/.pre-commit-config.yaml
---
.github/workflows/pre-commit.yml | 36 ++++++++++++++++++++++++++++++++++++
.pre-commit-config.yaml | 22 ++++++++++++++++++++++
2 files changed, 58 insertions(+)
diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml
new file mode 100644
index 00000000..1fc37ba8
--- /dev/null
+++ b/.github/workflows/pre-commit.yml
@@ -0,0 +1,36 @@
+name: Run pre-commit
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+permissions:
+ contents: read
+
+jobs:
+ pre-commit:
+ name: Run pre-commit hooks
+ runs-on: ubuntu-latest
+ steps:
+ - name: 'Checkout ${{ github.ref }} ( ${{ github.sha }} )'
+ uses: actions/checkout@v6
+ with:
+ persist-credentials: false
+ - uses: actions/setup-python@v6
+ with:
+ python-version: '3.13'
+ architecture: 'x64'
+ - name: Install dependencies
+ run: |
+ python -m pip install --upgrade pip
+ pip install pre-commit
+ - name: set PY
+ run: echo "PY=$(python -VV | sha256sum | cut -d' ' -f1)" >> $GITHUB_ENV
+ - uses: actions/cache@v5
+ with:
+ path: ~/.cache/pre-commit
+ key: pre-commit|${{ env.PY }}|${{
hashFiles('.pre-commit-config.yaml') }}
+ - name: Run pre-commit
+ run: pre-commit run --color=always --all-files --show-diff-on-failure
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
new file mode 100644
index 00000000..7cfbf9a5
--- /dev/null
+++ b/.pre-commit-config.yaml
@@ -0,0 +1,22 @@
+repos:
+- repo: meta
+ hooks:
+ - id: check-hooks-apply
+ name: check that hooks apply
+ description: check that all the hooks apply to the repository
+- repo: https://github.com/pre-commit/pre-commit-hooks
+ rev: v6.0.0
+ hooks:
+ - id: check-ast
+ - id: check-case-conflict
+ - id: check-illegal-windows-names
+ - id: check-json
+ - id: check-merge-conflict
+ - id: check-yaml
+ - id: detect-private-key
+ # - id: end-of-file-fixer
+ # - id: fix-byte-order-marker
+ - id: forbid-submodules
+ - id: mixed-line-ending
+ - id: trailing-whitespace
+ files: \.(cgi|rdf|rb)$