From ad0f61a74ba2488a358a7d9deeea108d64033385 Mon Sep 17 00:00:00 2001 From: kshitij katiyar <90389917+Kshitij-Katiyar@users.noreply.github.com> Date: Tue, 25 Jun 2024 16:41:37 +0530 Subject: [PATCH] Update github-actions-demo.yml --- .github/workflows/github-actions-demo.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/github-actions-demo.yml b/.github/workflows/github-actions-demo.yml index 932ffc6..08f4fbd 100644 --- a/.github/workflows/github-actions-demo.yml +++ b/.github/workflows/github-actions-demo.yml @@ -9,13 +9,22 @@ jobs: - name: Check out repository code uses: actions/checkout@v4 - run: echo "Building the project..." - - run: exit 1 # This will fail the build job + - run: exit 1 # This intentionally fails the build job Test: runs-on: ubuntu-latest needs: Build + if: failure() != true # Run this job only if the Build job did not fail steps: - - run: echo "🎉 The test job was triggered because the build job completed." + - run: echo "🎉 The test job was triggered because the build job completed successfully." - name: Check out repository code uses: actions/checkout@v4 - run: echo "Running tests..." + + Handle-Failure: + runs-on: ubuntu-latest + needs: Build + if: failure() # Run this job only if the Build job failed + steps: + - run: echo "❌ The build job failed. Handling failure..." + # You can add steps here to handle the failure, send notifications, etc.