From a193a5c645ef35d672530e705aaa587f661fd07b Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 17 Mar 2026 14:07:07 -0400 Subject: [PATCH] (add) pre-commit linter CI workflow Add .pre-commit-config.yaml and GitHub Actions workflow to run pre-commit checks on every pull request. git-pr-chain: add-precommit-ci Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/pre-commit.yml | 16 ++++++++++++++++ .pre-commit-config.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 42 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..d655e85dc --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,16 @@ +name: Pre-commit + +on: + pull_request: + +jobs: + pre-commit: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-python@v5 + with: + python-version: "3.11" + + - 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..9013409e9 --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,26 @@ +repos: + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v5.0.0 + hooks: + - id: trailing-whitespace + - id: end-of-file-fixer + - id: check-yaml + - id: check-added-large-files + - id: check-merge-conflict + + - repo: https://github.com/psf/black + rev: 24.10.0 + hooks: + - id: black + + - repo: https://github.com/pycqa/isort + rev: 5.13.2 + hooks: + - id: isort + args: ["--profile", "black"] + + - repo: https://github.com/pycqa/flake8 + rev: 7.1.1 + hooks: + - id: flake8 + args: ["--max-line-length=88", "--extend-ignore=E203,W503"]