Setup pre-commit and ruff #4
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 Check | |
on: pull_request | |
jobs: | |
pre-commit: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install pre-commit | |
run: pip install pre-commit | |
- name: Get changed files | |
id: changed-files | |
run: | | |
echo "files=$(git diff --name-only origin/main...HEAD | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
- name: Run pre-commit | |
continue-on-error: true | |
run: | | |
pre-commit run --files ${{ steps.changed-files.outputs.files }} |