add precommit workflow

This commit is contained in:
Simon 2025-07-01 20:18:55 +07:00
parent b6732971b4
commit d70874b7ee
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

37
.github/workflows/pre_commit.yml vendored Normal file
View File

@ -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