Skip to content

Commit 8e0d3c2

Browse files
committed
Update workflows-notify.yaml
1 parent 14b0323 commit 8e0d3c2

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

.github/workflows/workflows-notify.yaml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,14 @@ jobs:
3434
while IFS='|' read -r REPO WORKFLOW WORKFLOW_NAME; do
3535
[[ -z "$REPO" || -z "$WORKFLOW" ]] && continue
3636
FULL_REPO="ONLYOFFICE/$REPO"
37-
API_URL="https://api.github.com/repos/$FULL_REPO/actions/workflows/$WORKFLOW/runs?per_page=100"
38-
RUNS_RESPONSE="$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$API_URL")"
3937
40-
[[ ! $(echo "$RUNS_RESPONSE" | jq -e .workflow_runs) ]] && continue
38+
RUNS=$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
39+
"https://api.github.com/repos/$FULL_REPO/actions/workflows/$WORKFLOW/runs?per_page=100" |
40+
jq --arg start "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" '[.workflow_runs[]
41+
| select(.created_at >= $start and .head_branch | test("^(master|release/.+|hotfix/.+|develop)$"))]')
4142
42-
RUNS=$(echo "$RUNS_RESPONSE" | jq --arg start "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" '[.workflow_runs[]
43-
| select(.created_at >= $start)
44-
| select(.head_branch | test("^(master|release/.+|hotfix/.+|develop)$"))]')
45-
FAIL_COUNT=$(echo "$RUNS" | jq '[.[] | select((.conclusion? // "failure") | test("failure|failed|error|startup_failure"))] | length')
43+
COUNT=$(echo "$RUNS" | jq 'length')
44+
FAIL=$(echo "$RUNS" | jq '[.[] | select((.conclusion? // "failure") | test("failure|failed|error|startup_failure"))] | length')
4645
STATUS=$([[ $(echo "$RUNS" | jq 'length') -eq 0 ]] && echo "\u26AA" || ([[ $FAIL_COUNT -gt 0 ]] && echo "\uD83D\uDD34" || echo "\uD83D\uDFE2"))
4746
REPO_STATUS["$REPO"]+="$STATUS [$WORKFLOW_NAME](https://github.com/$FULL_REPO/actions/workflows/$WORKFLOW)\n"
4847
done <<< "$WORKFLOWS"

0 commit comments

Comments
 (0)