Skip to content

Simplify copilot-agent-analysis workflow using gh search prs --author "@copilot"#2028

Merged
pelikhan merged 8 commits intomainfrom
copilot/investigate-copilot-pr-list
Oct 20, 2025
Merged

Simplify copilot-agent-analysis workflow using gh search prs --author "@copilot"#2028
pelikhan merged 8 commits intomainfrom
copilot/investigate-copilot-pr-list

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Oct 20, 2025

Overview

This PR simplifies the copilot-agent-analysis workflow by replacing the gh search prs + jq approach with gh search prs --author "@copilot", which provides built-in server-side author filtering.

Workflow Update

The copilot-agent-analysis workflow has been updated to use gh search prs --author "@copilot"

Before (2 commands):

gh search prs repo:$REPO created:">=$DATE" --limit 1000 > raw.json
jq '[.[] | select(.author.login == "Copilot")]' raw.json > copilot-prs.json

After (1 command):

gh search prs --repo $REPO --author "@copilot" --created ">=$DATE" --limit 1000 > copilot-prs.json

Benefits:

  • ✅ Simpler (no jq needed for author filtering)
  • ✅ More efficient (server-side author filtering)
  • ✅ Single command instead of two
  • ✅ Eliminates intermediate raw file
  • ✅ Up to 1,000 results

Key Discovery

gh search prs supports an --author flag that provides server-side filtering for both date and author, combining efficiency with simplicity. This works for bot accounts including the Copilot bot (user ID 198982749).

Valid Syntaxes

All of these command variations work correctly:

gh search prs --author "@copilot"    # With @ prefix
gh search prs --author "copilot"     # Lowercase
gh search prs --author "Copilot"     # Capitalized (matches bot login)

Comparison

Feature gh pr list --author gh search prs --author (implemented) gh search prs + jq (old)
Max Results 100 1,000 1,000
Author Filtering ✅ Built-in (client-side) ✅ Built-in (server-side) ⚠️ Manual jq
Date Filtering ❌ Client-side only ✅ Server-side ✅ Server-side
Complexity ⭐ Simple (1 command) ⭐ Simple (1 command) ⭐⭐ Medium (2 commands)
Efficiency ⚠️ Fetches all, filters locally ✅ Server-side filtering ⚠️ Manual filtering
Best For Quick queries Production workflows Replaced

Changes Made

Workflow Implementation

  • .github/workflows/copilot-agent-analysis.md - Updated to use gh search prs --author "@copilot" instead of gh search prs + jq
  • .github/workflows/copilot-agent-analysis.lock.yml - Recompiled with updated workflow
  • pkg/cli/gh_pr_list_test.go - Unit tests documenting valid syntaxes and approach differences
  • Documentation updated to reflect the new recommended approach

Testing

All unit tests pass ✅

Conclusion

The copilot-agent-analysis workflow now uses gh search prs --author "@copilot", which is simpler and more efficient than the previous gh search prs + jq approach, eliminating the need for manual jq filtering.

Original prompt

Investigate if this command lists the copilot PR (compare to full list):

gh pr list --author "@copilot"


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

Copilot AI and others added 3 commits October 20, 2025 12:09
…entation

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title [WIP] Investigate command for copilot PR listing Investigate gh pr list --author "@copilot" command for listing Copilot PRs Oct 20, 2025
Copilot AI requested a review from pelikhan October 20, 2025 12:15
@pelikhan pelikhan closed this Oct 20, 2025
@pelikhan pelikhan reopened this Oct 20, 2025
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot investigate

gh search prs --repo github/sweagentd --author "@copilot"

…ations

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot investigate

gh search prs --repo github/sweagentd --author "@copilot"...

Excellent discovery! 🎉

I investigated gh search prs --author "@copilot" and found that it works and is actually the best solution!

Key Finding

gh search prs has an --author flag that provides:

  • ✅ Server-side author filtering (no jq needed!)
  • ✅ Server-side date filtering
  • ✅ Up to 1000 results
  • ✅ Single command

Recommended Approach

Instead of the current gh search prs + jq approach, we can use:

gh search prs --repo "${{ github.repository }}" \
  --author "@copilot" \
  --created ">=$DATE_30_DAYS_AGO" \
  --limit 1000 \
  --json number,title,state,createdAt,closedAt,author,body,labels,url,assignees

This eliminates the need for jq filtering and is simpler and more efficient.

Updated Files

Created GH_SEARCH_PRS_AUTHOR_INVESTIGATION.md with detailed analysis and updated all investigation reports with this finding.

Commit: 6da7a74 → (new commit being pushed)

Copilot AI changed the title Investigate gh pr list --author "@copilot" command for listing Copilot PRs Investigate gh pr list and gh search prs --author "@copilot" commands for listing Copilot PRs Oct 20, 2025
@pelikhan
Copy link
Copy Markdown
Collaborator

@copilot update copilot agent analyzis with best approach found. Only use one way to search copilot PRs.

…instead of jq filtering

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Oct 20, 2025

@copilot update copilot agent analyzis with best approach found. Only use one way to search copilot PRs.

Updated the copilot-agent-analysis workflow to use the best approach found: gh search prs --author "@copilot"

Changes Made

Simplified from 2 commands to 1:

Before:

gh search prs repo:$REPO created:">=$DATE" --limit 1000 > raw.json
jq '[.[] | select(.author.login == "Copilot")]' raw.json > copilot-prs.json

After:

gh search prs --repo $REPO --author "@copilot" --created ">=$DATE" --limit 1000 > copilot-prs.json

Benefits:

  • Server-side filtering (no jq needed)
  • Single command (simpler)
  • Eliminates intermediate file

Updated both the workflow step and documentation to use only this approach.

Commit: aa7ac2b → (new commit)

Copilot AI changed the title Investigate gh pr list and gh search prs --author "@copilot" commands for listing Copilot PRs Investigate and implement gh search prs --author "@copilot" for listing Copilot PRs Oct 20, 2025
Comment thread GH_SEARCH_PRS_AUTHOR_INVESTIGATION.md Outdated
@@ -0,0 +1,155 @@
# Additional Investigation: `gh search prs --author "@copilot"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot remove file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed GH_SEARCH_PRS_AUTHOR_INVESTIGATION.md

Commit: (being pushed)

Comment thread INVESTIGATION_REPORT.md Outdated
@@ -0,0 +1,297 @@
# Investigation Report: `gh pr list --author "@copilot"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot remove file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed INVESTIGATION_REPORT.md

Commit: (being pushed)

Comment thread SUMMARY.md Outdated
@@ -0,0 +1,146 @@
# Investigation Complete: `gh pr list --author "@copilot"` and `gh search prs --author "@copilot"`
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot remove file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed SUMMARY.md

Commit: (being pushed)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI changed the title Investigate and implement gh search prs --author "@copilot" for listing Copilot PRs Simplify copilot-agent-analysis workflow using gh search prs --author "@copilot" Oct 20, 2025
Copilot AI requested a review from pelikhan October 20, 2025 14:02
if [ "$COUNT7" -gt 0 ]; then
echo ""
echo "⚠️ Current approach (gh search prs + jq) works but is more complex"
echo " - Consider switching to gh search prs --author"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@copilot remove file

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Removed .github/workflows/test-copilot-pr-list.yml

Commit: (being pushed)

Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
Copilot AI requested a review from pelikhan October 20, 2025 14:13
@pelikhan pelikhan marked this pull request as ready for review October 20, 2025 14:14
@github-actions
Copy link
Copy Markdown
Contributor

Agentic Changeset Generator triggered by this pull request.

@pelikhan pelikhan merged commit fda3b18 into main Oct 20, 2025
7 checks passed
@pelikhan pelikhan deleted the copilot/investigate-copilot-pr-list branch October 20, 2025 14:15
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