From d70874b7ee7bb3cdcf8a95da0d45ef4546bd74fd Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 1 Jul 2025 20:18:55 +0700 Subject: [PATCH] add precommit workflow --- .github/workflows/pre_commit.yml | 37 ++++++++++++++++++++++++++++++++ 1 file changed, 37 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 0000000..f677b3c --- /dev/null +++ b/.github/workflows/pre_commit.yml @@ -0,0 +1,37 @@ +name: Lint, Test, Build, and Push Docker Image + +on: + push: + branches: + - '**' + tags: + - '**' + pull_request: + branches: + - '**' + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Cache pre-commit environment + uses: actions/cache@v3 + with: + path: | + ~/.cache/pre-commit + key: ${{ runner.os }}-pre-commit-${{ hashFiles('**/.pre-commit-config.yaml') }} + restore-keys: | + ${{ runner.os }}-pre-commit- + + - name: Install dependencies + run: | + pip install pre-commit + pre-commit install + + - name: Run pre-commit + run: | + pre-commit run --all-files