✨ 更新 pre-commit 工作流,使用虚拟环境中的 Python 运行 pre-commit 安装和执行 #9
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Pre-commit checks | |
on: [push, pull_request] | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Set up Python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: '3.10' # 选择适合你的项目的 Python 版本 | |
- name: Install dependencies | |
run: | | |
python -m pip install pdm | |
pdm install --no-lock | |
.venv/bin/python -m pre-commit install | |
- name: Run pre-commit | |
run: .venv/bin/python -m pre-commit run --all-files |