From dfee8f3da7210aad6c2ae40731f2523665729c84 Mon Sep 17 00:00:00 2001 From: Leo Date: Mon, 20 Apr 2026 17:34:18 +0200 Subject: [PATCH] CI: Implement automatic pre-commit checks with a GHA workflow (#320) * Create a pre-commit workflow * Update .pre-commit-config.yaml * Remove whitespaces --------- Co-authored-by: Jithun Nair <37884920+jithunnair-amd@users.noreply.github.com> Co-authored-by: Jithun Nair --- .github/workflows/pre-commit.yml | 16 ++++++++++++++++ .pre-commit-config.yaml | 18 ++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .github/workflows/pre-commit.yml create mode 100644 .pre-commit-config.yaml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 000000000..f6499ad40 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,16 @@ +name: pre-commit + +on: + push: + branches: [master, 'release/*'] + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + - uses: actions/setup-python@v5 + with: + python-version: '3.x' + - uses: pre-commit/action@v3.0.1 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 000000000..b41a9f7be --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,18 @@ +# Commands to run below checks locally: +# pre-commit try-repo https://github.com/pre-commit/pre-commit-hooks trailing-whitespace --all-files +# pre-commit try-repo https://github.com/pre-commit/pre-commit-hooks check-ast --all-files +# pre-commit try-repo https://github.com/pre-commit/pre-commit-hooks check-json --all-files +# pre-commit try-repo https://github.com/pre-commit/pre-commit-hooks check-merge-conflict --all-files +# pre-commit try-repo https://github.com/pre-commit/pre-commit-hooks check-toml --all-files +# pre-commit try-repo https://github.com/pre-commit/pre-commit-hooks check-yaml --all-files +fail_fast: false +repos: +- repo: https://github.com/pre-commit/pre-commit-hooks + rev: v6.0.0 # Use the ref you want to point at + hooks: + - id: trailing-whitespace + - id: check-ast + - id: check-json + - id: check-merge-conflict + - id: check-toml + - id: check-yaml