From 20e6a2486a52cf51fe1e2668a79531fe5b39ed20 Mon Sep 17 00:00:00 2001 From: "Martin Hinshelwood nkdAgility.com" Date: Thu, 8 Aug 2024 12:23:08 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A7=20(main.yml):=20update=20workflow?= =?UTF-8?q?=20conditions=20to=20ensure=20steps=20run=20only=20on=20success?= =?UTF-8?q?ful=20setup=20and=20relevant=20changes?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add success() condition to the build and BuildDocs jobs to ensure they only run if the Setup job is successful. This prevents unnecessary executions and potential errors. Also, refine the condition for the deploy job to ensure it runs only if there are changes in the source code and the setup is successful, excluding the 'Canary' ring. --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b49026f4a..98f88e276 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -131,11 +131,12 @@ jobs: echo $markdown >> $Env:GITHUB_STEP_SUMMARY # Build, Test, Sonar Cloud Analysis, & Package + build: name: "Build, Test, Sonar Cloud Analysis, & Package" runs-on: windows-latest needs: Setup - if: ${{ needs.Setup.outputs.HasChanged_src }} + if: ${{ success() && ( needs.Setup.outputs.HasChanged_src ) }} env: solution: '**/*.sln' buildPlatform: 'Any CPU' @@ -220,6 +221,7 @@ jobs: BuildDocs: name: "Build Documentation output" runs-on: ubuntu-latest + if: ${{ success() && ( needs.Setup.outputs.HasChanged_docs ) }} needs: [Setup] env: GitVersion_SemVer: ${{ needs.Setup.outputs.GitVersion_SemVer }} @@ -258,7 +260,7 @@ jobs: HasChanged_docs: ${{ needs.Setup.outputs.HasChanged_docs }} HasChanged_automation: ${{ needs.Setup.outputs.HasChanged_automation }} needs: [build, Setup] - if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) }} + if: ${{ success() && ( needs.Setup.outputs.nkdAgility_Ring != 'Canary' ) && ( needs.Setup.outputs.HasChanged_src ) }} steps: - uses: actions/download-artifact@v4 with: