-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Add get_pull_request_ci_failures tool to retrieve failed CI job logs for PRs #1527
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
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)