Skip to content

Conversation

@mattdholloway
Copy link
Contributor

@mattdholloway mattdholloway commented Dec 12, 2025

This PR concludes the Actions toolset consolidation rollout by bringing these changes back to the OSS repository

Closes: https://github.com/github/copilot-agent-services/issues/1053

@mattdholloway mattdholloway self-assigned this Dec 12, 2025
@mattdholloway mattdholloway marked this pull request as ready for review December 15, 2025 15:26
@mattdholloway mattdholloway requested a review from a team as a code owner December 15, 2025 15:26
Copilot AI review requested due to automatic review settings December 15, 2025 15:26
Copy link
Contributor

Copilot AI 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 consolidates multiple GitHub Actions tools into a smaller set of method-based tools to simplify the API surface. The consolidation groups related operations together:

  • Read operations: Multiple "list" and "get" tools consolidated into actions_list and actions_get
  • Write operations: Multiple "run", "rerun", "cancel", and "delete" tools consolidated into actions_run_trigger
  • Log retrieval: get_job_logs remains separate (renamed from GetJobLogs to ActionsGetJobLogs)

Key changes:

  • Tools now use a method parameter to specify the specific action to perform
  • Deprecated aliases maintain backward compatibility by mapping old tool names to new ones
  • Tests updated to reflect the new consolidated structure
  • Documentation regenerated to show new tool signatures

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
pkg/github/tools.go Registers consolidated tools (ActionsList, ActionsGet, ActionsRunTrigger, ActionsGetJobLogs) instead of individual tools
pkg/github/deprecated_tool_aliases.go Maps all old tool names to new consolidated tool names for backward compatibility
pkg/github/actions.go Major refactoring - removes individual tool functions, adds consolidated tools with method-based routing and helper functions
pkg/github/actions_test.go Refactors tests to test consolidated tools with method parameters, removes old individual tool tests
pkg/github/toolsnaps/*.snap New/updated snapshots for consolidated tool schemas
README.md Auto-generated documentation reflecting new tool structure

actionsMethodGetWorkflowRun = "get_workflow_run"
actionsMethodGetWorkflowJob = "get_workflow_job"
actionsMethodGetWorkflowRunUsage = "get_workflow_run_usage"
actionsMethodGetWorkflowRunLogsURL = "get_workflow_run_logs_url"
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The method constant uses "get_workflow_run_logs_url" but the deprecated tool alias maps "get_workflow_run_logs" to "actions_get". For consistency with the old tool name and to avoid confusion, the method should be named "get_workflow_run_logs" not "get_workflow_run_logs_url". The "_url" suffix is unnecessary since the method returns URL information anyway, and it creates a naming mismatch with the deprecated tool.

Suggested change
actionsMethodGetWorkflowRunLogsURL = "get_workflow_run_logs_url"
actionsMethodGetWorkflowRunLogs = "get_workflow_run_logs"

Copilot uses AI. Check for mistakes.
return ghErrors.NewGitHubAPIErrorResponse(ctx, "failed to cancel workflow run", resp, err), nil, nil
}
}
defer func() { _ = resp.Body.Close() }()
Copy link

Copilot AI Dec 15, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential nil pointer dereference. If the API call at line 887 returns an error that is NOT an AcceptedError, and resp is nil, then line 894 (defer resp.Body.Close()) will panic. The defer statement should be moved inside the error check or wrapped in a nil check. The other helper functions (rerunWorkflowRun, rerunFailedJobs, deleteWorkflowRunLogs) have the same pattern but don't have this special AcceptedError handling, so they're safe.

Suggested change
defer func() { _ = resp.Body.Close() }()
if resp != nil {
defer func() { _ = resp.Body.Close() }()
}

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants