Skip to content

Commit ef47e2c

Browse files
committed
Improve get_pull_request_ci_failures tool for comprehensive CI failure detection
- Query workflow runs for both head SHA and merge commit SHA to catch all CI runs - Add pagination for ListWorkflowJobs to find failures beyond the first page - Fetch third-party check runs (e.g., dorny/test-reporter) with annotations - Add configurable parameters: include_annotations, include_logs, tail_lines, max_failed_jobs - Use generic failure detection (no company-specific heuristics) - Increase bufio.Scanner buffer to 10MB to handle very long log lines - Add unit tests for merge SHA discovery, paginated jobs, and third-party check runs
1 parent d77a320 commit ef47e2c

File tree

4 files changed

+1130
-144
lines changed

4 files changed

+1130
-144
lines changed

pkg/buffer/buffer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func ProcessResponseAsRingBufferToEnd(httpResp *http.Response, maxJobLogLines in
3232
writeIndex := 0
3333

3434
scanner := bufio.NewScanner(httpResp.Body)
35-
scanner.Buffer(make([]byte, 0, 64*1024), 1024*1024)
35+
scanner.Buffer(make([]byte, 0, 64*1024), 10*1024*1024) // 10MB max line size
3636

3737
for scanner.Scan() {
3838
line := scanner.Text()

pkg/github/__toolsnaps__/get_pull_request_ci_failures.snap

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@
1212
"pullNumber"
1313
],
1414
"properties": {
15+
"include_annotations": {
16+
"type": "boolean",
17+
"description": "Include GitHub Check Run annotations - structured error messages with file/line info (default: true). Set to false to reduce output size.",
18+
"default": true
19+
},
20+
"include_logs": {
21+
"type": "boolean",
22+
"description": "Include tail of job logs for context (default: true). Set to false if annotations are sufficient or to reduce output size.",
23+
"default": true
24+
},
25+
"max_failed_jobs": {
26+
"type": "number",
27+
"description": "Maximum number of failed jobs to fetch details for (default: 3). Use 0 for no limit. Reduce if output is too large.",
28+
"default": 3
29+
},
1530
"owner": {
1631
"type": "string",
1732
"description": "Repository owner"
@@ -24,15 +39,10 @@
2439
"type": "string",
2540
"description": "Repository name"
2641
},
27-
"return_content": {
28-
"type": "boolean",
29-
"description": "Returns actual log content instead of URLs (default: true)",
30-
"default": true
31-
},
3242
"tail_lines": {
3343
"type": "number",
34-
"description": "Number of lines to return from the end of each log (default: 500)",
35-
"default": 500
44+
"description": "Number of log lines to include from end of each job (default: 100). Reduce if output is too large.",
45+
"default": 100
3646
}
3747
}
3848
},

0 commit comments

Comments
 (0)