Skip to content

Commit ee512da

Browse files
committed
changed the workflwo
1 parent 450074a commit ee512da

File tree

1 file changed

+43
-19
lines changed

1 file changed

+43
-19
lines changed

.github/workflows/auto-merge-queue.yml

Lines changed: 43 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,11 @@ jobs:
119119
PR_NUMBER="${{ steps.get_pr.outputs.pr_number }}"
120120
echo "⏳ Waiting for CI completion on PR #$PR_NUMBER (timeout: 10 minutes)"
121121
122-
# Function to check CI status (excluding auto-merge workflow)
122+
# Function to check specific Essential CI jobs by name
123123
check_ci_status() {
124+
# List of required CI jobs that must pass
125+
local required_jobs=("acceptance" "check_generated_code" "docker_image_amd64" "examples_orms" "lint" "local_roachtest" "local_roachtest_fips" "linux_amd64_build" "linux_amd64_fips_build" "unit_tests")
126+
124127
local response=$(gh api graphql \
125128
-f owner="${{ github.repository_owner }}" \
126129
-f repo="${{ github.event.repository.name }}" \
@@ -139,8 +142,6 @@ jobs:
139142
name
140143
}
141144
}
142-
conclusion
143-
status
144145
checkRuns(first: 50) {
145146
nodes {
146147
name
@@ -157,23 +158,46 @@ jobs:
157158
}
158159
}')
159160
160-
# Debug: Show all workflows
161-
echo "DEBUG: All workflows found:"
162-
echo "$response" | jq -r '.data.repository.pullRequest.commits.nodes[0].commit.checkSuites.nodes[] | select(.workflowRun.workflow.name != null) | .workflowRun.workflow.name'
161+
# Debug: Show all check runs
162+
echo "DEBUG: All check runs found:"
163+
echo "$response" | jq -r '.data.repository.pullRequest.commits.nodes[0].commit.checkSuites.nodes[].checkRuns.nodes[] | "\(.name): \(.conclusion // .status)"'
164+
165+
# Check status of specific required jobs only
166+
echo "DEBUG: Checking required CI jobs:"
167+
local all_success=true
168+
local any_failure=false
169+
local pending_jobs=()
163170
164-
# Filter out auto-merge workflow and calculate status
165-
local status=$(echo "$response" | jq -r '
166-
.data.repository.pullRequest.commits.nodes[0].commit.checkSuites.nodes
167-
| map(select(.workflowRun.workflow.name != "Auto Merge Queue on CI Success"))
168-
| map(.checkRuns.nodes[])
169-
| map(select(.conclusion != null))
170-
| if length == 0 then "PENDING"
171-
elif all(.conclusion == "success") then "SUCCESS"
172-
elif any(.conclusion == "failure") then "FAILURE"
173-
else "PENDING" end')
174-
175-
echo "DEBUG: Filtered status (excluding auto-merge): $status"
176-
echo "$status"
171+
for job in "${required_jobs[@]}"; do
172+
local job_status=$(echo "$response" | jq -r --arg job "$job" '
173+
.data.repository.pullRequest.commits.nodes[0].commit.checkSuites.nodes[].checkRuns.nodes[]
174+
| select(.name == $job)
175+
| .conclusion // .status')
176+
177+
echo " $job: $job_status"
178+
179+
if [[ "$job_status" == "success" ]]; then
180+
continue
181+
elif [[ "$job_status" == "failure" ]] || [[ "$job_status" == "cancelled" ]] || [[ "$job_status" == "timed_out" ]]; then
182+
any_failure=true
183+
break
184+
else
185+
all_success=false
186+
pending_jobs+=("$job")
187+
fi
188+
done
189+
190+
# Determine overall status
191+
if [[ "$any_failure" == true ]]; then
192+
echo "DEBUG: Overall status: FAILURE (some jobs failed)"
193+
echo "FAILURE"
194+
elif [[ "$all_success" == true ]]; then
195+
echo "DEBUG: Overall status: SUCCESS (all required jobs passed)"
196+
echo "SUCCESS"
197+
else
198+
echo "DEBUG: Overall status: PENDING (waiting for: ${pending_jobs[*]})"
199+
echo "PENDING"
200+
fi
177201
}
178202
179203
# Initial status check

0 commit comments

Comments
 (0)