Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
jaceksan wants to merge4 commits intogithub:main
base:main
Choose a base branch
Loading
fromjaceksan:add-pr-ci-failures-tool

Conversation

@jaceksan
Copy link

Summary

This PR adds a new toolget_pull_request_ci_failures that 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:

  1. Create a PR with code changes
  2. CI pipeline runs and fails
  3. Currently: Manually navigate to GitHub Actions, find the failed job, copy error logs, paste into the AI chat
  4. With this tool: The AI agent can directly retrieve the failure logs and suggest fixes

This significantly improves the developer experience by eliminating the tedious copy-paste cycle when debugging CI failures.

Features

  • Finds workflow runs triggered by a PR using the head SHA
  • Identifies failed workflow runs (failure, timed_out, cancelled conclusions)
  • Collects logs from all failed jobs with failed step information
  • Returns log content by default (configurable viareturn_content parameter)
  • Supportstail_lines parameter to limit log output (default: 500 lines)

Implementation Details

  • AddedGetPullRequestCIFailures function inpkg/github/actions.go
  • Added helper functiongetFailedJobsForRun to collect failed job logs for a workflow run
  • Reuses existinggetJobLogData function for log retrieval
  • Registered in bothpull_requests (default toolset) andactions toolsets
  • Comprehensive test coverage inpkg/github/actions_test.go

Tool 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

  • All existing tests pass
  • Added unit tests for the new tool covering:
    • Successful CI failure retrieval with failed jobs
    • No failed workflow runs scenario
    • No workflow runs found scenario
    • Missing required parameters
    • PR not found error handling
    • Content return with actual log content

Checklist

  • Tests pass (go test ./...)
  • Linter passes (script/lint)
  • Documentation updated (script/generate-docs)
  • Toolsnap created

chrisbonilla95, siennathesane, and BleedingDev reacted with heart emoji
CopilotAI review requested due to automatic review settingsDecember 3, 2025 19:54
@jaceksanjaceksan requested a review froma team as acode ownerDecember 3, 2025 19:54
Copy link
Contributor

CopilotAI left a 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 newget_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:

  • NewGetPullRequestCIFailures function andgetFailedJobsForRun helper inpkg/github/actions.go
  • Tool registered in bothpull_requests (default) andactions toolsets
  • 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
FileDescription
pkg/github/actions.goImplements new tool with PR lookup, workflow run filtering, and failed job log collection
pkg/github/actions_test.goAdds comprehensive test suite covering multiple scenarios including content retrieval
pkg/github/tools.goRegisters new tool in both pull_requests and actions toolsets
pkg/github/toolsnaps/get_pull_request_ci_failures.snapTool schema snapshot for API surface validation
README.mdDocuments new tool in both default and pull_requests toolset sections
docs/remote-server.mdUpdates toolset table (note: changes "Default" to "all" in first row)

@siennathesane
Copy link

I would love this so much lol

jaceksanand others added4 commitsDecember 16, 2025 09:37
…for PRsThis tool allows AI agents to automatically find and retrieve CI failure logsfor 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 outputThe 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
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

Copilot code reviewCopilotCopilot left review comments

At least 1 approving review is required to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@jaceksan@siennathesane

[8]ページ先頭

©2009-2025 Movatter.jp