Skip to content

Commit

Permalink
fix linter action
Browse files Browse the repository at this point in the history
  • Loading branch information
sainak committed Sep 19, 2023
1 parent 089c261 commit 5b8ca42
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,16 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
fetch-depth: ${{ github.event_name == 'pull_request' && 2 || 0 }}

- name: Get changed files
id: changed-files
run: |
if ${{ github.event_name == 'pull_request' }}; then
echo "changed_files=$(git diff -diff-filter=ACMR --name-only -r HEAD^1 HEAD | xargs)" >> $GITHUB_OUTPUT
else
echo "changed_files=$(git diff -diff-filter=ACMR --name-only ${{ github.event.before }} ${{ github.event.after }} | xargs)" >> $GITHUB_OUTPUT
fi
- uses: actions/setup-python@v4
with:
Expand All @@ -27,4 +36,4 @@ jobs:
key: pre-commit-3|${{ env.pythonLocation }}|${{ hashFiles('.pre-commit-config.yaml') }}

- name: Lint
run: pre-commit run --files $(git diff --name-only --diff-filter=ACMR ${{ github.event.before }} ${{ github.event.after }})
run: pre-commit run --files ${{ steps.changed-files.outputs.changed_files }}

0 comments on commit 5b8ca42

Please sign in to comment.