Change workflow: into a re-usable reference that can be extended
>>> [!note] Migrated issue <!-- Drupal.org comment --> <!-- Migrated from issue #3504083. --> Reported by: [jonathan1055](https://www.drupal.org/user/92645) Related to !326 >>> <h3 id="summary-problem-motivation">Problem/Motivation</h3> <p>The <code>workflow:</code> definition is hard-coded in <a href="https://git.drupalcode.org/project/gitlab_templates/-/blob/main/includes/include.drupalci.workflows.yml">includes/include.drupalci.workflows.yml</a>. Every one of these conditions is a positive test for when a pipeline should run. If a project wants to add another condition to this list, then currently the only to do this is duplicate the entire workflow: defintion and add the new rule. This is tedious, but also duplication means any fixes in gitlab_templates will not be available in the copy.</p> <p>The example which prompted this is <span class="drupalorg-gitlab-issue-link project-issue-status-info project-issue-status-7"><a href="https://www.drupal.org/project/gitlab_templates_downstream/issues/3503337" title="Status: Closed (fixed)">#3503337: Plan for initial codebase</a></span> but also there are other cases, in other projects.</p> <h3 id="summary-proposed-resolution">Proposed resolution</h3> <p>In the above file, convert <code>workflow:</code> to a reusable <code>.default-workflow: &amp;default-workflow</code> then define <code>workflow:</code> to reference this.</p> <p>Other projects can then define something like (untested) :</p> <pre>workflow:<br>&nbsp; rules:<br>&nbsp;&nbsp;&nbsp; - !reference [ .default-workflow ]<br>&nbsp;&nbsp;&nbsp; - if: $CI_COMMIT_BRANCH == "some-specific-branch"</pre>
issue