1515jobs :
1616 yamato-supervisor :
1717 runs-on : ubuntu-latest
18- env :
19- # The name of the Yamato check to monitor
20- CHECK_NAME : " [Yamato] Code changes PR checks"
21- # How long to wait for the check to appear before assuming it won't run
22- GRACE_PERIOD_SECONDS : 120 # 2 minutes
23- # How often to poll the GitHub API to see if job has finished (fail or succeeded)
24- POLLING_INTERVAL_SECONDS : 30
25-
2618 steps :
2719 - name : Checkout repository
2820 uses : actions/checkout@v4
3123 env :
3224 GH_TOKEN : ${{ secrets.GH_TOKEN }}
3325 run : |
34- start_time=$(date +%s)
35- timeout_seconds=$((TIMEOUT_MINUTES * 60))
36-
37- echo "Starting to monitor for the state of check: '$CHECK_NAME'"
38-
39- while true; do
40- current_time=$(date +%s)
41- elapsed_seconds=$((current_time - start_time))
42-
43- checks_json=$(gh pr checks ${{ github.event.pull_request.number }} --json name,state | jq ".[] | select(.name == \"$CHECK_NAME\")")
44-
45- if [ -z "$check_status" ]; then
46- if [ $elapsed_seconds -gt $GRACE_PERIOD_SECONDS ]; then
47- echo "Grace period of $GRACE_PERIOD_SECONDS seconds has passed and the check '$CHECK_NAME' was not found."
48- echo "Assuming it was not triggered (e.g., docs-only change). Success!"
49- exit 0
50- else
51- echo "Check '$CHECK_NAME' not found yet. Continuing to poll..."
52- fi
53- elif [ "$check_status" == "pending" ]; then
54- echo "Check '$CHECK_NAME' is currently '$check_status'. Waiting..."
55- elif [ "$check_status" == "pass" ]; then
56- echo "Check '$CHECK_NAME' completed with conclusion: 'success'."
57- exit 0
58- else
59- echo "::error::Check '$CHECK_NAME' completed with conclusion: '$check_status'."
60- exit 1
61- fi
62-
63- # Wait before the next poll
64- sleep $POLLING_INTERVAL_SECONDS
65- done
26+ sleep 30
27+ gh pr checks ${{ github.event.pull_request.number }} --watch --fail-fast --interval 30
0 commit comments