diff --git a/.github/actions/send-teams-notification/action.yml b/.github/actions/send-teams-notification/action.yml index 19eb36cd3..5a6a64af8 100644 --- a/.github/actions/send-teams-notification/action.yml +++ b/.github/actions/send-teams-notification/action.yml @@ -37,16 +37,15 @@ runs: if: ${{ inputs.status == '' }} shell: bash run: | - url="${GITHUB_API_URL}/repos" - repo="${GITHUB_REPOSITORY}" - run_id="${GITHUB_RUN_ID}" - token="${{ github.token }}" + API_URL="${GITHUB_API_URL}/repos/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}/jobs?per_page=100" - failure=$(curl -s -H "Authorization: token ${token}" "${url}/${repo}/actions/runs/${run_id}/jobs?per_page=100" | \ + RUNS=$(curl -s -H "Authorization: token ${{ github.token }}" "${API_URL}") + + failure=$(echo $RUNS | \ jq -r '.jobs[].steps[] | select(.status == "completed" and .conclusion == "failure").conclusion' | \ wc -l) - cancelled=$(curl -s -H "Authorization: token ${token}" "${url}/${repo}/actions/runs/${run_id}/jobs?per_page=100" | \ + failure=$(echo $RUNS | \ jq -r '.jobs[].steps[] | select(.status == "completed" and .conclusion == "cancelled").conclusion' | \ wc -l)