Skip to content

Commit ad0ae42

Browse files
committed
Update workflows-notify.yaml
1 parent e7325c7 commit ad0ae42

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

.github/workflows/workflows-notify.yaml

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,22 +37,17 @@ jobs:
3737
FULL_REPO="ONLYOFFICE/$REPO"
3838
REPO_LIST["$REPO"]=1
3939
WORKFLOW_URL="https://github.com/$FULL_REPO/actions/workflows/$WORKFLOW"
40-
RUNS_API_URL="https://api.github.com/repos/$FULL_REPO/actions/workflows/$WORKFLOW/runs?per_page=50"
40+
RUNS_API_URL="https://api.github.com/repos/$FULL_REPO/actions/workflows/$WORKFLOW/runs?per_page=100"
4141
RUNS_RESPONSE="$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "$RUNS_API_URL")"
4242
4343
[[ ! $(echo "$RUNS_RESPONSE" | jq -e .workflow_runs) ]] && continue
4444
45-
RUNS=$(echo "$RUNS_RESPONSE" | jq --arg start "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" \
46-
'[.workflow_runs[]
47-
| select(.created_at >= $start)
48-
| select(.head_branch | test("^(master|release/.+|hotfix/.+|develop)$"))]')
49-
45+
RUNS=$(echo "$RUNS_RESPONSE" | jq --arg start "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" '[.workflow_runs[]
46+
| select(.created_at >= $start)
47+
| select(.head_branch | test("^(master|release/.+|hotfix/.+|develop)$"))]')
5048
TOTAL_COUNT=$(echo "$RUNS" | jq 'length')
5149
FAIL_COUNT=$(echo "$RUNS" | jq '[.[] | select((.conclusion? // "failure") | test("failure|failed|error|startup_failure"))] | length')
52-
53-
STATUS="\u26AA"
54-
(( TOTAL_COUNT > 0 )) && STATUS=$([[ $FAIL_COUNT -gt 0 ]] && echo "\uD83D\uDD34" || echo "\uD83D\uDFE2")
55-
50+
STATUS=$([[ $TOTAL_COUNT -eq 0 ]] && echo "\u26AA" || ([[ $FAIL_COUNT -gt 0 ]] && echo "\uD83D\uDD34" || echo "\uD83D\uDFE2"))
5651
REPO_STATUS["$REPO"]+="$STATUS [$WORKFLOW_NAME]($WORKFLOW_URL)\n"
5752
done <<< "$WORKFLOWS"
5853
@@ -64,3 +59,7 @@ jobs:
6459
-H "Content-Type: application/json" \
6560
-d "{\"chat_id\": \"${TELEGRAM_CHAT_ID}\", \"text\": \"$RESULT\", \"parse_mode\": \"Markdown\", \"disable_web_page_preview\": true}"
6661
62+
# [[ -n "$RESULT" ]] && curl -s "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/getUpdates" | jq -r '.result[].message.chat.id' | sort -u | \
63+
# xargs -I {} curl -s -X POST "https://api.telegram.org/bot${TELEGRAM_BOT_TOKEN}/sendMessage" -H "Content-Type: application/json" \
64+
# -d "{\"chat_id\": \"{}\", \"text\": \"$RESULT\", \"parse_mode\": \"Markdown\", \"disable_web_page_preview\": true}"
65+

0 commit comments

Comments
 (0)