Skip to content

Commit b1dcc79

Browse files
committed
Update main.yml
1 parent 15fea9a commit b1dcc79

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

.github/workflows/main.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,31 @@ jobs:
2424
with:
2525
python-version: '3.13'
2626

27-
- uses: pre-commit/action@v3.0.1
27+
- name: install pre-commit
28+
run: python3 -m pip install pre-commit
29+
30+
- name: Checkout code
31+
uses: actions/checkout@v5
32+
with:
33+
fetch-depth: 0
34+
35+
- name: Get changed files
36+
id: changed-files
37+
run: |
38+
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }} | tr '\n' ' ')
39+
echo "CHANGED_FILES=${CHANGED_FILES}" >> $GITHUB_ENV
40+
41+
- name: Print changed files
42+
run: |
43+
echo "Changed files: $CHANGED_FILES"
44+
45+
- name: Run pre-commit on changed files
46+
run: |
47+
if [ -n "$CHANGED_FILES" ]; then
48+
pre-commit run --color always --files $CHANGED_FILES --show-diff-on-failure
49+
else
50+
echo "No changed files to check."
51+
fi
2852
2953
pytest:
3054
needs: code-quality

0 commit comments

Comments
 (0)