Skip to content

Commit 4f8988a

Browse files
committed
add github and pre-commit actions
1 parent 7b52c89 commit 4f8988a

File tree

2 files changed

+34
-0
lines changed

2 files changed

+34
-0
lines changed

.github/workflows/ruff.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Ruff
2+
on: [push, pull_request]
3+
jobs:
4+
ruff:
5+
runs-on: ubuntu-latest
6+
steps:
7+
- uses: actions/checkout@v4
8+
- uses: tj-actions/changed-files@v45
9+
name: Get changed files
10+
id: changed-files
11+
with:
12+
files: |
13+
**.py
14+
- if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
15+
uses: astral-sh/ruff-action@v3
16+
with:
17+
version: "0.9.3"
18+
args: "check --fix"
19+
src: ${{ steps.changed-files.outputs.all_changed_files }}
20+
- if: ${{ steps.changed-files.outputs.any_changed == 'true' }}
21+
uses: astral-sh/ruff-action@v3
22+
with:
23+
version: "0.9.3"
24+
args: "format --check"
25+
src: ${{ steps.changed-files.outputs.all_changed_files }}

.pre-commit-config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
repos:
2+
- repo: https://github.com/astral-sh/ruff-pre-commit
3+
# Ruff version.
4+
rev: v0.9.3
5+
hooks:
6+
# Run the linter.
7+
- id: ruff
8+
# Run the formatter.
9+
- id: ruff-format

0 commit comments

Comments
 (0)