diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 1cc64e0e3d875aa9f03b1ce4fb81a35936efb2dc..5cb57c81758e3ea40477edd60a0d386474c5e910 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -29,6 +29,14 @@ cache:
   - make setup_headless
   - source .venv/bin/activate
 
+pre-commit:
+  tags: [shell, envinf]
+  rules:
+    - if: $CI_MERGE_REQUEST_IID
+  needs: []
+  script:
+    - pre-commit run --from-ref ${CI_MERGE_REQUEST_DIFF_BASE_SHA} --to-ref HEAD
+
 build:
   script:
     - pip install build
@@ -38,7 +46,6 @@ tests (arch):
   tags: [shell, envinf]
   needs: []
   script:
-    - pre-commit run --all-files
     - *setup-headless
     - make test