From 9cce56f316c4bed98e095256a92e088a9427f46c Mon Sep 17 00:00:00 2001
From: Jonathan Smith <jonathan1055@sandfordsolutions.com>
Date: Tue, 4 Feb 2025 13:49:47 +0000
Subject: [PATCH 1/7] Convert workflow: into re-usable reference

---
 includes/include.drupalci.workflows.yml | 39 ++++++++++++++-----------
 1 file changed, 22 insertions(+), 17 deletions(-)

diff --git a/includes/include.drupalci.workflows.yml b/includes/include.drupalci.workflows.yml
index f19206a4..3c9b3401 100644
--- a/includes/include.drupalci.workflows.yml
+++ b/includes/include.drupalci.workflows.yml
@@ -13,22 +13,27 @@
 # https://gitlab.com/help/ci/pipelines/schedules
 ################
 
+# Define the default workflow rule as a re-usable reference so that these can be extended
+# with additional rules if a customized workflow is required.
+.default-workflow: &default-workflow
+  # These 3 rules from https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Workflows/MergeRequest-Pipelines.gitlab-ci.yml
+  # Run on merge requests
+  - if: $CI_MERGE_REQUEST_IID
+  - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+  # Run on tags
+  - if: $CI_COMMIT_TAG
+  # Run when called from an upstream pipeline https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html?tab=Multi-project+pipeline#use-rules-to-control-downstream-pipeline-jobs
+  - if: $CI_PIPELINE_SOURCE == 'pipeline'
+  - if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
+  # Run on commits to the default & release branches.
+  - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^[78]\.x-\d+\.x$|^[\d+.]+\.x$/) && $CI_PROJECT_ROOT_NAMESPACE == "project"
+  # The last rule above blocks manual and scheduled pipelines on non-default branch. The rule below allows them:
+  - if: $CI_PIPELINE_SOURCE == "schedule"
+  # Run if triggered from Web using 'Run Pipelines'
+  - if: $CI_PIPELINE_SOURCE == "web"
+  # Run if triggered from WebIDE
+  - if: $CI_PIPELINE_SOURCE == "webide"
+
 workflow:
   rules:
-    # These 3 rules from https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Workflows/MergeRequest-Pipelines.gitlab-ci.yml
-    # Run on merge requests
-    - if: $CI_MERGE_REQUEST_IID
-    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
-    # Run on tags
-    - if: $CI_COMMIT_TAG
-    # Run when called from an upstream pipeline https://docs.gitlab.com/ee/ci/pipelines/downstream_pipelines.html?tab=Multi-project+pipeline#use-rules-to-control-downstream-pipeline-jobs
-    - if: $CI_PIPELINE_SOURCE == 'pipeline'
-    - if: $CI_PIPELINE_SOURCE == 'parent_pipeline'
-    # Run on commits to the default & release branches.
-    - if: ($CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH || $CI_COMMIT_BRANCH =~ /^[78]\.x-\d+\.x$|^[\d+.]+\.x$/) && $CI_PROJECT_ROOT_NAMESPACE == "project"
-    # The last rule above blocks manual and scheduled pipelines on non-default branch. The rule below allows them:
-    - if: $CI_PIPELINE_SOURCE == "schedule"
-    # Run if triggered from Web using 'Run Pipelines'
-    - if: $CI_PIPELINE_SOURCE == "web"
-    # Run if triggered from WebIDE
-    - if: $CI_PIPELINE_SOURCE == "webide"
+    - *default-workflow
-- 
GitLab


From 2eef123992d31feff5ff25d478b56e7092846632 Mon Sep 17 00:00:00 2001
From: Jonathan Smith <jonathan1055@sandfordsolutions.com>
Date: Wed, 5 Feb 2025 09:57:41 +0000
Subject: [PATCH 2/7] Add comment about documentation

---
 includes/include.drupalci.workflows.yml | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/includes/include.drupalci.workflows.yml b/includes/include.drupalci.workflows.yml
index 3c9b3401..92f06c7a 100644
--- a/includes/include.drupalci.workflows.yml
+++ b/includes/include.drupalci.workflows.yml
@@ -14,7 +14,9 @@
 ################
 
 # Define the default workflow rule as a re-usable reference so that these can be extended
-# with additional rules if a customized workflow is required.
+# with additional rules if a customized workflow is required. For information on how to
+# customize your workflow see https://project.pages.drupalcode.org/gitlab_templates/info/customizations/
+# @todo - write this documentation
 .default-workflow: &default-workflow
   # These 3 rules from https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Workflows/MergeRequest-Pipelines.gitlab-ci.yml
   # Run on merge requests
-- 
GitLab


From 1a798b256f28e87c02961530181f8b5893eb31d9 Mon Sep 17 00:00:00 2001
From: Jonathan Smith <jonathan1055@sandfordsolutions.com>
Date: Wed, 5 Feb 2025 10:04:10 +0000
Subject: [PATCH 3/7] Temp chnage to test 3504332-d7-basic-workflow-mr326
 branch

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index deb03196..3fc6132d 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -79,8 +79,8 @@ workflow:
   extends: .downstream-base
   trigger:
     strategy: depend
-    project: project/gitlab_templates_downstream
-    branch: d7-basic
+    project: issue/gitlab_templates_downstream-3504332
+    branch: 3504332-d7-basic-workflow-mr326
 
 '→ GTD D7 Composer':
   extends: .downstream-base
-- 
GitLab


From cc3efb5bfad6f2010072d33bf724aab8c2fd346f Mon Sep 17 00:00:00 2001
From: Jonathan Smith <jonathan1055@sandfordsolutions.com>
Date: Wed, 5 Feb 2025 14:01:26 +0000
Subject: [PATCH 4/7] remove testing repo and branch

---
 .gitlab-ci.yml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 3fc6132d..deb03196 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -79,8 +79,8 @@ workflow:
   extends: .downstream-base
   trigger:
     strategy: depend
-    project: issue/gitlab_templates_downstream-3504332
-    branch: 3504332-d7-basic-workflow-mr326
+    project: project/gitlab_templates_downstream
+    branch: d7-basic
 
 '→ GTD D7 Composer':
   extends: .downstream-base
-- 
GitLab


From 145f55622832296feafca6d2aa0d36ea50930a41 Mon Sep 17 00:00:00 2001
From: Jonathan Smith <20701-jonathan1055@users.noreply.drupalcode.org>
Date: Wed, 5 Feb 2025 14:25:31 +0000
Subject: [PATCH 5/7] Workflow paragraph in customization page

---
 docs/info/customizations.md | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/docs/info/customizations.md b/docs/info/customizations.md
index c83a4940..db820792 100644
--- a/docs/info/customizations.md
+++ b/docs/info/customizations.md
@@ -107,3 +107,17 @@ The name of the project being tested is derived from the `*.info.yml` file in th
 variables:
   PROJECT_NAME: 'my_project'
 ```
+
+## Workflow
+
+The [workflow](https://docs.gitlab.com/ee/ci/yaml/workflow.html) of a repository defines when pipelines will be run. Various events, such as creating a Merge Request, committing to the default branch or submitting via the pipeline UI can be used in combinations of rules, and if any of the conditions are true then the pipeline will be run. Gitlab Templates defines a [default workflow](https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.workflows.yml) which in most cases will be exactly what your project needs. However, if you do need to extend this default workflow, you can use the following:
+
+```
+workflow:
+  rules:
+    - !reference [ .default-workflow ]
+    - {add your extra rule here}
+    - {and another}
+```
+Using this syntax (a) avoids duplicating the entire default workflow, and (b) ensures your project will get any updates or improvements made to the standard workflow. 
+
-- 
GitLab


From b78d37038cc2b9fbf3a0e1aff0d751318f2052ec Mon Sep 17 00:00:00 2001
From: Jonathan Smith <20701-jonathan1055@users.noreply.drupalcode.org>
Date: Wed, 5 Feb 2025 15:43:47 +0000
Subject: [PATCH 6/7] Apply 1 suggestion(s) to 1 file(s)

Co-authored-by: Fran Garcia-Linares <14157-fjgarlin@users.noreply.drupalcode.org>
---
 docs/info/customizations.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/info/customizations.md b/docs/info/customizations.md
index db820792..3dee72ef 100644
--- a/docs/info/customizations.md
+++ b/docs/info/customizations.md
@@ -119,5 +119,5 @@ workflow:
     - {add your extra rule here}
     - {and another}
 ```
-Using this syntax (a) avoids duplicating the entire default workflow, and (b) ensures your project will get any updates or improvements made to the standard workflow. 
+Using this syntax avoids duplicating the entire default workflow, and ensures your project will get any updates or improvements made to the standard workflow. 
 
-- 
GitLab


From a402cc0c47f1937d400fbb9f0d7a3dea7e220c06 Mon Sep 17 00:00:00 2001
From: Jonathan Smith <jonathan1055@sandfordsolutions.com>
Date: Wed, 5 Feb 2025 15:50:34 +0000
Subject: [PATCH 7/7] remove docs url and @todo

---
 docs/info/customizations.md             | 5 ++---
 includes/include.drupalci.workflows.yml | 4 +---
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/docs/info/customizations.md b/docs/info/customizations.md
index 3dee72ef..2f61de7e 100644
--- a/docs/info/customizations.md
+++ b/docs/info/customizations.md
@@ -29,7 +29,7 @@ composer (previous major):
     PHP_VERSION: 8.1
 ```
 
-Variables can be defined in the project's `.gitlab-ci.yml` as above, or in the pipeline UI form when setting scheduled pipelines or running a pipeline manually. Form fields will override the values defined in the file or derived in the gitlab templates processing. This [variable precedence hierarchy](https://docs.gitlab.com/ee/ci/variables/index.html#cicd-variable-precedence) page has the full details. 
+Variables can be defined in the project's `.gitlab-ci.yml` as above, or in the pipeline UI form when setting scheduled pipelines or running a pipeline manually. Form fields will override the values defined in the file or derived in the gitlab templates processing. This [variable precedence hierarchy](https://docs.gitlab.com/ee/ci/variables/index.html#cicd-variable-precedence) page has the full details.
 
 ## Jobs
 
@@ -119,5 +119,4 @@ workflow:
     - {add your extra rule here}
     - {and another}
 ```
-Using this syntax avoids duplicating the entire default workflow, and ensures your project will get any updates or improvements made to the standard workflow. 
-
+Using this syntax avoids duplicating the entire default workflow, and ensures your project will get any updates or improvements made to the standard workflow.
diff --git a/includes/include.drupalci.workflows.yml b/includes/include.drupalci.workflows.yml
index 92f06c7a..3c9b3401 100644
--- a/includes/include.drupalci.workflows.yml
+++ b/includes/include.drupalci.workflows.yml
@@ -14,9 +14,7 @@
 ################
 
 # Define the default workflow rule as a re-usable reference so that these can be extended
-# with additional rules if a customized workflow is required. For information on how to
-# customize your workflow see https://project.pages.drupalcode.org/gitlab_templates/info/customizations/
-# @todo - write this documentation
+# with additional rules if a customized workflow is required.
 .default-workflow: &default-workflow
   # These 3 rules from https://gitlab.com/gitlab-org/gitlab/-/blob/master/lib/gitlab/ci/templates/Workflows/MergeRequest-Pipelines.gitlab-ci.yml
   # Run on merge requests
-- 
GitLab