From 02402a80e97d6ee29cd5808266470c4b99ed6edc Mon Sep 17 00:00:00 2001 From: guarin <43336610+guarin@users.noreply.github.com> Date: Thu, 10 Mar 2022 10:02:18 +0100 Subject: [PATCH] Only run tests if python files changed (#729) * Do not run pre-commit hook tests if untested files change --- .pre-commit-config.yaml | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6281a02a6..bee9f0bcf 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -12,5 +12,18 @@ repos: entry: make test language: system pass_filenames: false - always_run: true stages: [push] + # Avoid running tests if non-tested files have changed. + # The regex follows the pattern in the docs: https://pre-commit.com/#regular-expressions + exclude: | + (?x)^( + benchmark_logs/.*| + docs/.*| + examples/.*| + \.gitignore| + CONTRIBUTING\.md| + DOCS\.md| + LICENSE\.txt| + PRECOMMITHOOKS\.md| + README\.md + )$