Skip to content

fix: Use git to derive changed files instead #903

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/workflows/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,17 @@ jobs:
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Get changed files
- name: Fetch all branches and tags
run: git fetch --prune --unshallow
- name: Determine changed files
id: changed-files
uses: tj-actions/[email protected]
run: |
CHANGED_FILES=$(git diff --name-only HEAD^ | xargs)
echo "Changed files: $CHANGED_FILES"
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV
- name: Run Check
uses: pre-commit/[email protected]
with:
extra_args: >-
--files ${{ steps.changed-files.outputs.all_changed_files }}
--files ${{ env.CHANGED_FILES }}
--hook-stage manual