@@ -44,47 +44,41 @@ jobs:
4444 current_time=$(date +%s)
4545 elapsed_seconds=$((current_time - start_time))
4646
47- # --- Timeout Check ---
48- if [ $elapsed_seconds -gt $timeout_seconds ]; then
49- echo "::error::Timeout of $TIMEOUT_MINUTES minutes reached. The Yamato job '$CHECK_NAME' did not complete in time."
50- exit 1
51- fi
47+ # --- Timeout Check ---
48+ if [ $elapsed_seconds -gt $timeout_seconds ]; then
49+ echo "::error::Timeout of $TIMEOUT_MINUTES minutes reached. The Yamato job '$CHECK_NAME' did not complete in time."
50+ exit 1
51+ fi
5252
53- # --- Get PR Checks using GitHub CLI ---
54- # https://cli.github.com/manual/gh_pr_checks
55- # This command gets all checks for the current PR in JSON format
56- checks_json=$(gh pr checks ${{ github.event.pull_request.number }} --json name,state)
53+ # --- Get PR Checks using GitHub CLI ---
54+ # https://cli.github.com/manual/gh_pr_checks
55+ # This command gets all checks for the current PR in JSON format
56+ checks_json=$(gh pr checks ${{ github.event.pull_request.number }} --json name,state)
5757
58- # --- Find our specific check using jq ---
59- check_status=$(echo "$checks_json" | jq -r ".[] | select(.name == \"$CHECK_NAME\") | .state")
58+ # --- Find our specific check using jq ---
59+ check_status=$(echo "$checks_json" | jq -r ".[] | select(.name == \"$CHECK_NAME\") | .state")
6060
61- # --- Main Logic ---
62- if [ -z "$check_status" ]; then
63- # Case 1: The check has not appeared yet.
64- if [ $elapsed_seconds -gt $GRACE_PERIOD_SECONDS ]; then
65- echo "Grace period of $GRACE_PERIOD_SECONDS seconds has passed and the check '$CHECK_NAME' was not found."
66- echo "Assuming it was not triggered (e.g., docs-only change). Success!"
67- exit 0
68- else
69- echo "Check '$CHECK_NAME' not found yet. Continuing to poll..."
70- fi
71- elif [ "$check_status" == "pending" ]; then
72- # Case 2: The check is running.
73- echo "Check '$CHECK_NAME' is currently '$check_status'. Waiting..."
74- elif [ "$check_status" == "pass" ]; then
75- # Case 3: The check has finished.
76- echo "Check '$CHECK_NAME' completed with conclusion: 'success'. Great!"
77- exit 0
78- else
79- echo "::error::Check '$CHECK_NAME' completed with conclusion: '$check_status'."
80- exit 1
81- fi
82- else
83- # Case 4: Something unexpected happened.
84- echo "::error::Unknown state for check '$CHECK_NAME': '$check_status'."
85- exit 1
86- fi
61+ if [ -z "$check_status" ]; then
62+ # Case 1: The check has not appeared yet.
63+ if [ $elapsed_seconds -gt $GRACE_PERIOD_SECONDS ]; then
64+ echo "Grace period of $GRACE_PERIOD_SECONDS seconds has passed and the check '$CHECK_NAME' was not found."
65+ echo "Assuming it was not triggered (e.g., docs-only change). Success!"
66+ exit 0
67+ else
68+ echo "Check '$CHECK_NAME' not found yet. Continuing to poll..."
69+ fi
70+ elif [ "$check_status" == "pending" ]; then
71+ # Case 2: The check is running.
72+ echo "Check '$CHECK_NAME' is currently '$check_status'. Waiting..."
73+ elif [ "$check_status" == "pass" ]; then
74+ # Case 3: The check has finished.
75+ echo "Check '$CHECK_NAME' completed with conclusion: 'success'. Great!"
76+ exit 0
77+ else
78+ echo "::error::Check '$CHECK_NAME' completed with conclusion: '$check_status'."
79+ exit 1
80+ fi
8781
8882 # Wait before the next poll
89- sleep $POLLING_INTERVAL_SECONDS
90- done
83+ sleep $POLLING_INTERVAL_SECONDS
84+ done
0 commit comments