Skip to content

Commit 450074a

Browse files
committed
auto merge remove self
1 parent 22ab107 commit 450074a

File tree

1 file changed

+38
-5
lines changed

1 file changed

+38
-5
lines changed

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

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,9 @@ 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
122+
# Function to check CI status (excluding auto-merge workflow)
123123
check_ci_status() {
124-
gh api graphql \
124+
local response=$(gh api graphql \
125125
-f owner="${{ github.repository_owner }}" \
126126
-f repo="${{ github.event.repository.name }}" \
127127
-F number="$PR_NUMBER" \
@@ -132,15 +132,48 @@ jobs:
132132
commits(last: 1) {
133133
nodes {
134134
commit {
135-
statusCheckRollup {
136-
state
135+
checkSuites(first: 20) {
136+
nodes {
137+
workflowRun {
138+
workflow {
139+
name
140+
}
141+
}
142+
conclusion
143+
status
144+
checkRuns(first: 50) {
145+
nodes {
146+
name
147+
conclusion
148+
status
149+
}
150+
}
151+
}
137152
}
138153
}
139154
}
140155
}
141156
}
142157
}
143-
}' --jq '.data.repository.pullRequest.commits.nodes[0].commit.statusCheckRollup.state'
158+
}')
159+
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'
163+
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"
144177
}
145178
146179
# Initial status check

0 commit comments

Comments
 (0)