From b0c8b8fe1e847861e9783e7086b6ecd57ab2ebd9 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 17 Mar 2026 13:57:47 -0400 Subject: [PATCH 1/3] (add) pre-commit linter CI workflow Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/pre-commit.yml | 19 +++++++++++++++++++ .pre-commit-config.yaml | 26 ++++++++++++++++++++++++++ 2 files changed, 45 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 00000000..12a7c6e9 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,19 @@ +name: Pre-commit + +on: + push: + branches: ["**"] + pull_request: + branches: ["**"] + +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 00000000..9013409e --- /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"] From 75f83120a2f46f0f6da844483837b8b2d61d18d8 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 17 Mar 2026 14:00:12 -0400 Subject: [PATCH 2/3] (fix) avoid duplicate CI runs for PRs Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/pre-commit.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 12a7c6e9..9ec07268 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -2,9 +2,8 @@ name: Pre-commit on: push: - branches: ["**"] + branches: [main] pull_request: - branches: ["**"] jobs: pre-commit: From 45188d633b13095db026fadc41c7d4d51854d629 Mon Sep 17 00:00:00 2001 From: Hao Wu Date: Tue, 17 Mar 2026 14:00:50 -0400 Subject: [PATCH 3/3] (fix) only trigger pre-commit CI on pull requests Co-Authored-By: Claude Opus 4.6 (1M context) --- .github/workflows/pre-commit.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml index 9ec07268..d655e85d 100644 --- a/.github/workflows/pre-commit.yml +++ b/.github/workflows/pre-commit.yml @@ -1,8 +1,6 @@ name: Pre-commit on: - push: - branches: [main] pull_request: jobs: