Skip to content

Commit

Permalink
Update workflows-notify.yaml
Browse files Browse the repository at this point in the history
  • Loading branch information
isboston committed Feb 10, 2025
1 parent ab6f203 commit 7a2918a
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/workflows-notify.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,15 @@ jobs:
run: |
declare -A REPO_STATUS
while IFS='|' read -r REPO WORKFLOW WORKFLOW_NAME; do
[[ -z "$REPO" || -z "$WORKFLOW" ]] && continue
FULL_REPO="ONLYOFFICE/$REPO"
RUNS_RESPONSE="$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/$FULL_REPO/actions/workflows/$WORKFLOW/runs?per_page=100")"
RUNS_RESPONSE="$(curl -s -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/repos/ONLYOFFICE/$REPO/actions/workflows/$WORKFLOW/runs?per_page=100")"
[[ ! $(echo "$RUNS_RESPONSE" | jq -e .workflow_runs) ]] && continue
RUNS=$(echo "$RUNS_RESPONSE" | jq --arg start "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" '[.workflow_runs[]
| select(.created_at >= $start)
RUNS=$(echo "$RUNS_RESPONSE" | jq --arg start "$(date -u -d '24 hours ago' +%Y-%m-%dT%H:%M:%SZ)" '[.workflow_runs[]| select(.created_at >= $start)
| select(.head_branch | test("^(master|release/.+|hotfix/.+|develop)$"))]')
FAIL_COUNT=$(echo "$RUNS" | jq '[.[] | select((.conclusion? // "failure") | test("failure|failed|error|startup_failure"))] | length')
STATUS=$([[ $(echo "$RUNS" | jq 'length') -eq 0 ]] && echo "\u26AA" || ([[ $FAIL_COUNT -gt 0 ]] && echo "\uD83D\uDD34" || echo "\uD83D\uDFE2"))
REPO_STATUS["$REPO"]+="$STATUS [$WORKFLOW_NAME](https://github.com/$FULL_REPO/actions/workflows/$WORKFLOW)\n"
REPO_STATUS["$REPO"]+="$STATUS [$WORKFLOW_NAME](https://github.com/ONLYOFFICE/$REPO/actions/workflows/$WORKFLOW)\n"
done <<< "$WORKFLOWS"
for REPO in "${!REPO_STATUS[@]}"; do
Expand Down

0 comments on commit 7a2918a

Please sign in to comment.