Skip to content

Commit 023383f

Browse files
committed
cleanup
1 parent 345cc8c commit 023383f

File tree

1 file changed

+4
-20
lines changed

1 file changed

+4
-20
lines changed

.github/workflows/pr-supervisor.yaml

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
# GitHub Actions workflow to monitor Yamato CI job state on pull requests
2+
# We are using https://cli.github.com/manual/gh_pr_checks
3+
# The aim is to ensure that conditionally triggered Yamato jobs are completed successfully before allowing merges
24

35
name: Yamato PR Supervisor
46

@@ -20,8 +22,6 @@ jobs:
2022
GRACE_PERIOD_SECONDS: 120 # 2 minutes
2123
# How often to poll the GitHub API to see if job has finished (fail or succeeded)
2224
POLLING_INTERVAL_SECONDS: 30
23-
# Max time to wait for the job to finish
24-
TIMEOUT_MINUTES: 360
2525

2626
steps:
2727
- name: Checkout repository
@@ -31,10 +31,6 @@ jobs:
3131
env:
3232
GH_TOKEN: ${{ secrets.GH_TOKEN }}
3333
run: |
34-
# Give Yamato a moment to trigger its jobs
35-
echo "Waiting for 2 minutes to allow Yamato jobs to start..."
36-
sleep 120
37-
3834
start_time=$(date +%s)
3935
timeout_seconds=$((TIMEOUT_MINUTES * 60))
4036
@@ -43,20 +39,8 @@ jobs:
4339
while true; do
4440
current_time=$(date +%s)
4541
elapsed_seconds=$((current_time - start_time))
46-
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
52-
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)
5742
58-
# --- Find our specific check using jq ---
59-
check_status=$(echo "$checks_json" | jq -r ".[] | select(.name == \"$CHECK_NAME\") | .state")
43+
checks_json=$(gh pr checks ${{ github.event.pull_request.number }} --json name,state | jq ".[] | select(.name == \"$CHECK_NAME\")")
6044
6145
if [ -z "$check_status" ]; then
6246
# Case 1: The check has not appeared yet.
@@ -72,7 +56,7 @@ jobs:
7256
echo "Check '$CHECK_NAME' is currently '$check_status'. Waiting..."
7357
elif [ "$check_status" == "pass" ]; then
7458
# Case 3: The check has finished.
75-
echo "Check '$CHECK_NAME' completed with conclusion: 'success'. Great!"
59+
echo "Check '$CHECK_NAME' completed with conclusion: 'success'."
7660
exit 0
7761
else
7862
echo "::error::Check '$CHECK_NAME' completed with conclusion: '$check_status'."

0 commit comments

Comments
 (0)