From 9871311fb54afe1ff0d976ff3ab809199e41e5a8 Mon Sep 17 00:00:00 2001 From: dennis-avesani-zupit <135589847+dennis-avesani-zupit@users.noreply.github.com> Date: Thu, 11 Apr 2024 09:02:13 +0200 Subject: [PATCH] docs(ZCH-53): add concurrent workflow runs section and adjust jira move to developed (#102) * docs: add concurrent workflow runs section and adjust jira move to developed * docs: update jira move to developed approach --- README.md | 46 ++++++++++++++++++++++++++++++++++------------ 1 file changed, 34 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index b4992523..664d1366 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,7 @@ If you would like to get more details of these tasks, just look at this [doc](do 9. [Others](#others) 1. [Sonar Analyze](#sonar-analyze) 2. [Sonar Analyze - .NET](#sonar-analyze---net) + 10. [Concurrent workflow runs](#concurrent-workflow-runs) ## Composite Actions @@ -1638,21 +1639,20 @@ jobs: name: Jira Move to Developed on: - workflow_run: - workflows: [Main Workflow] - types: - - completed + push: + branches: [ "main", "release/*" ] jobs: - jira-move-issue-to-developed: - uses: zupit-it/pipeline-templates/.github/workflows/jira-step-move-issue.yml@v1.22.0 - if: ${{ github.event.workflow_run.conclusion == 'success' }} - with: - LABELS: "['pinga', 'pipeline', 'native']" - STATUS: "Developed" - BRANCH_OR_COMMIT_TITLE: ${{ github.event.workflow_run.head_commit.message }} - secrets: inherit + jira-move-issue-to-developed: + uses: zupit-it/pipeline-templates/.github/workflows/jira-step-move-issue.yml@v1.22.0 + with: + STATUS: "Developed" + BRANCH_OR_COMMIT_TITLE: ${{ github.event.head_commit.message }} + secrets: inherit ``` + +--- + #### Jira Add Description to PR ###### Workflow @@ -1867,3 +1867,25 @@ jobs: SONAR_PROJECT_KEY: "my-project-key" secrets: inherit ``` + +--- + +#### Concurrent Workflow Runs +Use the concurrency feature to manage overlapping workflow runs, ensuring only the most recent commit in branches like main triggers a workflow. +This optimizes resource usage and keeps deployments current. + +##### Main Workflow Example with Concurrency +```yaml +on: + push: + branches: [ "main", "release/*" ] + +concurrency: + group: ${{ github.ref }} + cancel-in-progress: true + +jobs: + ... +``` +*Note:* When using concurrency with workflows that trigger others, ensure subsequent workflows account for potential cancellations of initiating workflows. +This may involve status checks or logic adjustments for such cases.