From c9ee78c05a595808e82b8ba2d6127dab654ffbb8 Mon Sep 17 00:00:00 2001 From: fzyzcjy Date: Fri, 10 Oct 2025 18:31:07 +0800 Subject: [PATCH] more --- .github/workflows/pre-commit.yml | 41 ++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/pre-commit.yml diff --git a/.github/workflows/pre-commit.yml b/.github/workflows/pre-commit.yml new file mode 100644 index 00000000000..d0e05b27cb4 --- /dev/null +++ b/.github/workflows/pre-commit.yml @@ -0,0 +1,41 @@ +name: pre-commit + +on: + push: + branches: [main] + pull_request: + types: [opened, synchronize, reopened, ready_for_review] + +permissions: + contents: read + +jobs: + run-pre-commit: + name: Run pre-commit + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: '3.10' + cache: 'pip' + + - name: Install pre-commit + run: pip install --upgrade pip pre-commit + + - name: Cache pre-commit environments + uses: actions/cache@v4 + with: + path: ~/.cache/pre-commit + key: pre-commit-${{ runner.os }}-${{ hashFiles('.pre-commit-config.yaml') }} + restore-keys: | + pre-commit-${{ runner.os }}- + + - name: Run pre-commit on all files + run: pre-commit run --all-files --show-diff-on-failure --color=always +