From eac4a6b7f3904313acaa6a0f3287689069b5d280 Mon Sep 17 00:00:00 2001
From: Christos Tsolakis <christos.tsolakis@kitware.com>
Date: Fri, 18 Aug 2023 16:08:42 -0400
Subject: [PATCH] ci: Skip ci if only changes in the Documentation directory
 occurred

In practice we add a job only if any file outside of ./Documentation changed
---
 .gitlab/rules.yml | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/.gitlab/rules.yml b/.gitlab/rules.yml
index ac00675a8ef..c5bb306cd43 100644
--- a/.gitlab/rules.yml
+++ b/.gitlab/rules.yml
@@ -1,30 +1,47 @@
 # Rules for where jobs can run
 
+.run_on_code_change:
+  rules:
+      changes: &code_change
+        - '[a-zA-CE-Z]*' # any path starting with anything but 'D'
+        - 'Domains/*'    # any path under Domains directory is touched
+        - '.*'           # any hidden file is touched
+      when: on_success
+
+
 .run_automatically:
     rules:
         - if: '$CI_MERGE_REQUEST_ID'
+          changes: *code_change
           when: on_success
         - if: '$CI_PROJECT_PATH == "vtk/vtk"'
+          changes: *code_change
           when: on_success
         - when: never
 
 .run_scheduled:
     rules:
         - if: '$CI_MERGE_REQUEST_ID'
+          changes: *code_change
           when: manual
         - if: '$CI_COMMIT_TAG && $CI_PROJECT_PATH == "vtk/vtk"'
+          changes: *code_change
           when: on_success
         - if: '$CI_PIPELINE_SOURCE == "schedule" && $CI_PROJECT_PATH == "vtk/vtk"'
+          changes: *code_change
           when: on_success
         - when: never
 
 .run_manually:
     rules:
         - if: '$CI_MERGE_REQUEST_ID'
+          changes: *code_change
           when: manual
         - if: '$CI_PROJECT_PATH == "vtk/vtk" && $CI_PIPELINE_SOURCE == "schedule"'
+          changes: *code_change
           when: on_success
         - if: '$CI_PROJECT_PATH == "vtk/vtk"'
+          changes: *code_change
           when: delayed
           start_in: 30 minutes
         - when: never
-- 
GitLab