ci: clarify opencode review completion (#1420)
This commit is contained in:
+38
-4
@@ -117,7 +117,23 @@ extract_checks_json() {
|
||||
((.state // "") | lower_or_null) as $state
|
||||
| if $state == "pending" or $state == "expected" then null else $state end
|
||||
end;
|
||||
$checks_in | map({
|
||||
def preferred_check_order:
|
||||
if .conclusion == "success" then 0
|
||||
elif .status != "completed" then 1
|
||||
elif (
|
||||
.conclusion != null
|
||||
and .conclusion != "neutral"
|
||||
and .conclusion != "skipped"
|
||||
and .conclusion != "cancelled"
|
||||
) then 2
|
||||
elif .conclusion == "neutral" then 3
|
||||
elif .conclusion == "skipped" then 4
|
||||
elif .conclusion == "cancelled" then 5
|
||||
else 6
|
||||
end;
|
||||
$checks_in
|
||||
| to_entries
|
||||
| map(.value + {_index: .key} | {
|
||||
type: (.["__typename"] // null),
|
||||
name: (.name // .context // "unknown"),
|
||||
workflow: (.workflowName // .workflow // .checkSuite.workflowRun.workflow.name // null),
|
||||
@@ -126,8 +142,18 @@ extract_checks_json() {
|
||||
details_url: (.detailsUrl // null),
|
||||
target_url: (.targetUrl // null),
|
||||
run_id: ((.detailsUrl // null) | extract("/actions/runs/(?<id>[0-9]+)"; "id")),
|
||||
job_id: ((.detailsUrl // null) | extract("/job/(?<id>[0-9]+)"; "id"))
|
||||
job_id: ((.detailsUrl // null) | extract("/job/(?<id>[0-9]+)"; "id")),
|
||||
_index
|
||||
})
|
||||
| sort_by([(.workflow // ""), .name])
|
||||
| group_by([(.workflow // ""), .name])
|
||||
| map({
|
||||
first_index: (map(._index) | min),
|
||||
items: sort_by(preferred_check_order, ._index)
|
||||
})
|
||||
| sort_by(.first_index)
|
||||
| map(.items[])
|
||||
| map(del(._index))
|
||||
'
|
||||
}
|
||||
|
||||
@@ -186,6 +212,14 @@ extract_review_threads_json() {
|
||||
|
||||
summarize_state_json() {
|
||||
jq -c '
|
||||
def effective_checks:
|
||||
.checks
|
||||
| to_entries
|
||||
| map(.value + {_index: .key})
|
||||
| sort_by([(.workflow // ""), .name])
|
||||
| group_by([(.workflow // ""), .name])
|
||||
| map(sort_by(._index) | .[0] | del(._index));
|
||||
|
||||
def bad_conclusion:
|
||||
.conclusion != null
|
||||
and .conclusion != "success"
|
||||
@@ -207,12 +241,12 @@ summarize_state_json() {
|
||||
pr,
|
||||
since,
|
||||
failed_checks: [
|
||||
.checks[]
|
||||
effective_checks[]
|
||||
| select(terminal_failure_status and bad_conclusion)
|
||||
| {name, workflow, status, conclusion, run_id, job_id, details_url, target_url}
|
||||
],
|
||||
pending_checks: [
|
||||
.checks[]
|
||||
effective_checks[]
|
||||
| select(pending_status and .conclusion == null)
|
||||
| {name, workflow, status, run_id, job_id, details_url, target_url}
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user