File tree Expand file tree Collapse file tree 1 file changed +30
-1
lines changed
Expand file tree Collapse file tree 1 file changed +30
-1
lines changed Original file line number Diff line number Diff line change 1818jobs :
1919 yamato-supervisor :
2020 runs-on : ubuntu-latest
21+ timeout-minutes : 720
2122 steps :
2223 - name : Checkout repository
2324 uses : actions/checkout@v4
2425
2526 - name : Wait and Verify Yamato Job Status
2627 env :
2728 GH_TOKEN : ${{ secrets.GH_TOKEN }}
29+ PR_NUMBER : ${{ github.event.pull_request.number }}
2830 run : |
31+ set -e
2932 sleep 30
30- gh pr checks ${{ github.event.pull_request.number }} --watch --fail-fast --interval 60
33+
34+ MAX_ATTEMPTS=$((12*60))
35+ INTERVAL=60
36+
37+ for ((i=1;i<=MAX_ATTEMPTS;i++)); do
38+ echo "Polling PR checks (attempt $i/$MAX_ATTEMPTS)..."
39+ # We want to watch for pending checks beside this check
40+ checks=$(gh pr checks $PR_NUMBER --json name,state --jq '[ .[] | select(.name != "yamato-supervisor") ]')
41+
42+ pending=$(echo "$checks" | jq '[.[] | select(.state == "pending")] | length')
43+ skipping=$(echo "$checks" | jq '[.[] | select(.state == "skipping")] | length')
44+ failed=$(echo "$checks" | jq '[.[] | select(.state == "fail")] | length')
45+
46+ if [[ "$failed" -gt 0 ]]; then
47+ echo "A check has failed! Failing fast."
48+ exit 1
49+ fi
50+
51+ echo "Pending checks: $pending, Skipping checks: $skipping"
52+
53+ if [[ "$pending" -eq 0 ]]; then
54+ echo "All non-supervisor checks are completed!"
55+ exit 0
56+ fi
57+
58+ sleep $INTERVAL
59+ done
You can’t perform that action at this time.
0 commit comments