Add get_pull_request_ci_failures tool to retrieve failed CI job logs for PRs#1527
Open
jaceksan wants to merge 4 commits intogithub:mainfrom
Open
Add get_pull_request_ci_failures tool to retrieve failed CI job logs for PRs#1527jaceksan wants to merge 4 commits intogithub:mainfrom
jaceksan wants to merge 4 commits intogithub:mainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new get_pull_request_ci_failures tool that enables AI agents to automatically retrieve CI failure logs for pull requests, eliminating the need for manual log extraction from the GitHub web UI. The tool finds workflow runs triggered by a PR's head SHA, identifies failed runs (failure, timed_out, cancelled), and collects logs from all failed jobs with step-level failure information.
Key changes:
- New
GetPullRequestCIFailuresfunction andgetFailedJobsForRunhelper inpkg/github/actions.go - Tool registered in both
pull_requests(default) andactionstoolsets - Comprehensive test coverage including success cases, edge cases, and error handling
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| pkg/github/actions.go | Implements new tool with PR lookup, workflow run filtering, and failed job log collection |
| pkg/github/actions_test.go | Adds comprehensive test suite covering multiple scenarios including content retrieval |
| pkg/github/tools.go | Registers new tool in both pull_requests and actions toolsets |
| pkg/github/toolsnaps/get_pull_request_ci_failures.snap | Tool schema snapshot for API surface validation |
| README.md | Documents new tool in both default and pull_requests toolset sections |
| docs/remote-server.md | Updates toolset table (note: changes "Default" to "all" in first row) |
|
I would love this so much lol |
…for PRs This tool allows AI agents to automatically find and retrieve CI failure logs for a pull request without manual copy-pasting from the GitHub web UI. Features: - Finds workflow runs triggered by a PR using the head SHA - Identifies failed workflow runs (failure, timed_out, cancelled) - Collects logs from all failed jobs with failed step information - Returns log content by default (configurable via return_content) - Supports tail_lines parameter to limit log output The tool is added to both pull_requests (default) and actions toolsets.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…e 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
f382e84 to
ef47e2c
Compare
MrAllgoodWilson
approved these changes
Dec 27, 2025
MrAllgoodWilson
approved these changes
Dec 27, 2025
MrAllgoodWilson
approved these changes
Dec 27, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds a new tool
get_pull_request_ci_failuresthat allows AI agents to automatically find and retrieve CI failure logs for a pull request without manual copy-pasting from the GitHub web UI.Use Case
When working with AI coding assistants like Cursor, GitHub Copilot, or Claude, a common workflow is:
This significantly improves the developer experience by eliminating the tedious copy-paste cycle when debugging CI failures.
Features
return_contentparameter)tail_linesparameter to limit log output (default: 500 lines)Implementation Details
GetPullRequestCIFailuresfunction inpkg/github/actions.gogetFailedJobsForRunto collect failed job logs for a workflow rungetJobLogDatafunction for log retrievalpull_requests(default toolset) andactionstoolsetspkg/github/actions_test.goTool Schema
{ "name": "get_pull_request_ci_failures", "description": "Get failed CI workflow job logs for a pull request...", "inputSchema": { "required": ["owner", "repo", "pullNumber"], "properties": { "owner": { "type": "string" }, "repo": { "type": "string" }, "pullNumber": { "type": "number" }, "return_content": { "type": "boolean", "default": true }, "tail_lines": { "type": "number", "default": 500 } } } }Testing
Checklist
go test ./...)script/lint)script/generate-docs)