refactor github actions for ruff

This commit is contained in:
Taylor Wilsdon
2026-02-17 21:06:03 -05:00
parent e90e22d719
commit 3d9d0fb473
3 changed files with 25 additions and 28 deletions

View File

@@ -1,4 +1,4 @@
name: Ruff Check
name: Ruff
on:
pull_request:
@@ -7,13 +7,16 @@ on:
branches: [ main ]
permissions:
contents: read
contents: write
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.head_ref || github.ref }}
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/setup-python@v6
with:
python-version: '3.11'
@@ -21,5 +24,21 @@ jobs:
uses: astral-sh/setup-uv@v7
- name: Install dependencies
run: uv sync
- name: Run ruff check
run: uv run ruff check
- name: Auto-fix ruff lint and format
if: github.event_name == 'pull_request'
run: |
uv run ruff check --fix
uv run ruff format
- name: Commit and push fixes
if: github.event_name == 'pull_request'
run: |
git diff --quiet && exit 0
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git add -A
git commit -m "style: auto-fix ruff lint and format"
git push || echo "::warning::Could not push auto-fixes — fork PRs require 'Allow edits from maintainers' enabled"
- name: Validate
run: |
uv run ruff check
uv run ruff format --check