Skip to content

Commit 97d29b1

Browse files
committed
Updated pr-supervisor script to extend timeout to 12h and modified logic to not wait for itself
1 parent 12deb8d commit 97d29b1

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

.github/workflows/pr-supervisor.yaml

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,42 @@ on:
1818
jobs:
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

0 commit comments

Comments
 (0)