Skip to content

Only run the pre-commit hook on changed files #3145

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
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
17 changes: 16 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,24 @@ on:
branches: [master]

jobs:
file-diff:
runs-on: ubuntu-latest
outputs:
git-diff: ${{ steps.git-diff.outputs.diff }}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Find changed files
uses: technote-space/get-diff-action@v4.0.1
id: git-diff
with:
PATTERNS: |
+(src|exe|test|ghcide|plugins|hls-plugin-api|hie-compat|hls-graph|hls-test-utils)/**/*.hs
pre-commit:
runs-on: ubuntu-latest
needs: file-diff
steps:
- uses: actions/checkout@v3

- uses: ./.github/actions/setup-build
with:
os: ${{ runner.os }}
Expand Down Expand Up @@ -40,3 +53,5 @@ jobs:

- uses: actions/setup-python@v4
- uses: pre-commit/action@v3.0.0
with:
extra_args: --files ${{ needs.file-diff.outputs.git-diff }}