Skip to content

Enhancement: Optimize Get-OriginalPRCommits to use PR commits directly #290

@rjmurillo-bot

Description

@rjmurillo-bot

Origin

PR #202 comment 2639566878 from Copilot

Current Behavior

Get-OriginalPRCommits function:

  1. Line 103: Fetches PR with gh pr view --json commits
  2. Line 111: Queries ALL repository commits via gh api repos/.../commits and filters

This is inefficient on large repositories and may hit API rate limits.

Enhancement

Use the commits already retrieved from gh pr view:

$pr = gh pr view $PRNumber --json commits 2> | ConvertFrom-Json
if ($null -eq $pr -or -not $pr.commits) {
    return @()
}
return $pr.commits

Rationale

  • Eliminates redundant API call
  • Avoids rate limit risk on large repos
  • Already have the data from line 103

Acceptance Criteria

  • Remove redundant gh api call at line 111
  • Return $pr.commits directly
  • Verify Pester tests still pass
  • Test on PR with >10 commits

Metadata

Metadata

Assignees

Labels

agent-qaTesting and verification agentarea-workflowsGitHub Actions workflowsenhancementNew feature or requestpriority:P2Normal: Standard enhancement or bug fix, moderate impactpriority:P3Low: Nice to have, future consideration, minor improvementtechnical-debtCode or infrastructure that needs cleanup, refactoring, or optimization to reduce maintenance burden

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions