From 13e8811a546ae11e53808263d29ac28138a7ff59 Mon Sep 17 00:00:00 2001 From: John Watson Date: Thu, 12 Dec 2024 20:49:02 +0000 Subject: [PATCH] fix: amend trigger for api tests failure as github wasn't honouring the failure condition --- .github/workflows/e2e-validation.yml | 4 ++-- .github/workflows/run-api-test.yml | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/e2e-validation.yml b/.github/workflows/e2e-validation.yml index 808f8c3c89..9811557586 100644 --- a/.github/workflows/e2e-validation.yml +++ b/.github/workflows/e2e-validation.yml @@ -127,7 +127,7 @@ jobs: runs-on: ubuntu-latest needs: cypress-tests environment: ${{ inputs.environment }} - if: ${{ failure() && github.ref == 'refs/heads/main' }} + if: failure() steps: - name: Download all artifacts uses: actions/download-artifact@v4 @@ -145,7 +145,7 @@ jobs: fi done # If at least one valid failure marker is present, then page - if [ "$has_artifacts" = true ]; then + if [ "$has_artifacts" = true ] && [ "${{ github.ref_name }}" = "main" ]; then curl --location "${{ secrets.FIREHYDRANT_WEBHOOK_URL }}" \ --header "Content-Type: application/json" \ --data "{ diff --git a/.github/workflows/run-api-test.yml b/.github/workflows/run-api-test.yml index c402f02fb2..f06197223a 100644 --- a/.github/workflows/run-api-test.yml +++ b/.github/workflows/run-api-test.yml @@ -128,14 +128,16 @@ jobs: exit "$exit_code" - name: Upload artifact if exit code 53 - if: ${{ failure() && env.last_exit_code == '53' }} + if: failure() run: | - echo "Uploading marker for test ${{ matrix.tests.name }}" - mkdir -p artifacts/${{ matrix.tests.name }} - echo "failure-marker" > artifacts/${{ matrix.tests.name }}/failure-marker + if [ "${{ env.last_exit_code }}" == "53" ]; then + echo "Uploading marker for test ${{ matrix.tests.name }}" + mkdir -p artifacts/${{ matrix.tests.name }} + echo "failure-marker" > artifacts/${{ matrix.tests.name }}/failure-marker + fi - name: Upload artifacts - if: ${{ failure() && env.last_exit_code == '53' }} + if: failure() uses: actions/upload-artifact@v4 with: name: ${{ matrix.tests.name }} @@ -145,7 +147,7 @@ jobs: runs-on: ubuntu-latest needs: api-test environment: ${{ inputs.environment }} - if: ${{ failure() && github.ref == 'refs/heads/main' }} + if: failure() steps: - name: Download all artifacts uses: actions/download-artifact@v4 @@ -163,7 +165,7 @@ jobs: fi done # If at least one valid failure marker is present, then page - if [ "$has_artifacts" = true ]; then + if [ "$has_artifacts" = true ] && [ "${{ github.ref_name }}" = "main" ]; then curl --location "${{ secrets.FIREHYDRANT_WEBHOOK_URL }}" \ --header "Content-Type: application/json" \ --data "{