Skip to content

Commit

Permalink
simplify bash logic
Browse files Browse the repository at this point in the history
  • Loading branch information
atchertchian committed Dec 18, 2024
1 parent 226f48b commit 4c925cb
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions .github/actions/send-teams-notification/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4c925cb

Please sign in to comment.