Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 31, 2025

Adds the find-reviewable-pr skill from PureWeen/maui PR #9 to help find open PRs in the dotnet/maui and dotnet/docs-maui repositories that are good candidates for review.

Changes Made

  • .github/skills/find-reviewable-pr/SKILL.md - Skill documentation including usage guide, priority categories, script parameters, and workflow for reviewing PRs
  • .github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1 - PowerShell script that queries GitHub for open PRs and prioritizes them dynamically by milestone (lower SR numbers first), P/0 priority, partner status, community contributions, and recency

Features

The skill provides:

  • Priority-based PR categorization (P/0, Milestoned, Partner, Community, Recent)
  • Dynamic milestone sorting: Milestones are sorted by SR number (e.g., SR5 before SR6) so prioritization remains correct as milestones advance monthly
  • Platform filtering (Android, iOS, Windows, MacCatalyst)
  • Multiple output formats (review, table, JSON)
  • Complexity assessment for PRs
  • Review status tracking
  • docs-maui support: Returns 5 priority PRs and 5 recent PRs from dotnet/docs-maui by default
    • New -DocsLimit parameter to control docs-maui PR count
    • New -Category docs-maui filter option to show only docs-maui PRs
  • Recent PRs: Shows 5 recent PRs from both maui and docs-maui by default
    • New -RecentLimit parameter to control recent PRs from maui (default: 5)
Original prompt

Create a PR that just grabs the find-reviewable-pr's skill from this PR PureWeen#9


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@PureWeen
Copy link
Member

@copilot It looks like you got stuck. Just grab the changes from this folder https://github.com/PureWeen/maui/tree/1a1738d2b66a03d09ccd853717cae1801c0abbe7/.github/skills/find-reviewable-pr for the skill I Want you to create a PR for

Copy link
Contributor Author

Copilot AI commented Dec 31, 2025

@copilot It looks like you got stuck. Just grab the changes from this folder https://github.com/PureWeen/maui/tree/1a1738d2b66a03d09ccd853717cae1801c0abbe7/.github/skills/find-reviewable-pr for the sk...

Added the find-reviewable-pr skill from your branch in commit f53ef7f. This includes:

  • .github/skills/find-reviewable-pr/SKILL.md - Documentation and usage guide
  • .github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1 - PowerShell script with PR prioritization logic

Copilot AI changed the title [WIP] Add find-reviewable-pr skill from existing PR Add find-reviewable-pr skill from existing PR Dec 31, 2025
@PureWeen
Copy link
Member

PureWeen commented Jan 1, 2026

@copilot add docs-maui to the list of prs returned

The defualt should always return 5 from docs-maui

5 based on priority

And then 5 based on how recent they are

Copy link
Contributor Author

Copilot AI commented Jan 1, 2026

@copilot add docs-maui to the list of prs returned

The defualt should always return 5 from docs-maui
...

Added docs-maui support in commit 7520333. The script now:

  • Queries dotnet/docs-maui repository in addition to dotnet/maui
  • Returns 5 priority PRs and 5 recent PRs from docs-maui by default
  • New -DocsLimit parameter to adjust the count (default: 5)
  • New -Category docs-maui filter to show only docs-maui PRs

@PureWeen
Copy link
Member

PureWeen commented Jan 1, 2026

@copilot show 5 recent from maui and docs

Copy link
Contributor Author

Copilot AI commented Jan 1, 2026

@copilot show 5 recent from maui and docs

Updated in commit 8732f31. The script now shows 5 recent PRs from both maui and docs-maui by default:

  • New -RecentLimit parameter (default: 5) controls recent PRs from maui
  • docs-maui recent continues to use -DocsLimit (default: 5)

@PureWeen
Copy link
Member

PureWeen commented Jan 2, 2026

@copilot please show me the results from this skill just asking it "show me what prs I should review"

Copy link
Contributor Author

Copilot AI commented Jan 2, 2026

@copilot please show me the results from this skill just asking it "show me what prs I should review"

I can't run the script directly in my environment because it requires GitHub CLI authentication (GH_TOKEN). However, here's what you'd see when running the skill with "show me what PRs I should review":

pwsh .github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1

Example output:

╔═══════════════════════════════════════════════════════════╗
║           Finding Reviewable PRs                          ║
╚═══════════════════════════════════════════════════════════╝

Fetching open PRs from dotnet/maui...
  Found 45 non-draft open PRs in dotnet/maui

Fetching open PRs from dotnet/docs-maui...
  Found 12 non-draft open PRs in dotnet/docs-maui

🔴 PRIORITY (P/0) PRs - 2 found
-----------------------------------------------------------
===
Number:12345
Title:Fix critical crash on Android
URL:https://github.com/dotnet/maui/pull/12345
Author:contributor1
Platform:Android
Complexity:Easy
Milestone:SR3
ReviewStatus:🔍 Review Required

📅 MILESTONED PRs - 8 found
✨ COMMUNITY PRs - 5 found
🕐 RECENT PRs (last 2 weeks) - 5 found
📚 DOCS-MAUI PRIORITY PRs - 2 found
📖 DOCS-MAUI RECENT PRs - 5 found

SUMMARY
  Priority (P/0): 2
  Milestoned: 8
  Partner: 3
  Community: 5
  Recent (2 weeks): 15
  docs-maui Priority: 2
  docs-maui Recent: 5

To test it locally, run with authenticated GitHub CLI.

@PureWeen
Copy link
Member

PureWeen commented Jan 2, 2026

@copilot cant you pass in your token?

Copy link
Contributor Author

Copilot AI commented Jan 2, 2026

@copilot cant you pass in your token?

I don't have access to a GitHub token in my environment - gh auth status shows I'm not logged into any GitHub hosts, and there are no GITHUB_TOKEN or GH_TOKEN environment variables available. My environment is sandboxed and doesn't include GitHub API credentials for security reasons.

- Add exponential backoff retry (3 attempts) for transient GitHub API errors (502, 503, timeout)
- Filter recent PRs to only show those waiting for review (REVIEW_REQUIRED)
- Add -ExcludeAuthors and -IncludeAuthors parameters for author filtering
- When -Category recent is specified, show ALL recent PRs (not just uncategorized)
- Ensure minimum 5 PRs shown for recent and docs-maui categories
- Update SKILL.md documentation
- Add scope detection that tests for read:project before querying
- Display helpful message with fix command when scope is missing
- Reset LASTEXITCODE before Invoke-Expression to prevent false failures
- Gracefully degrade by excluding projectItems field when scope unavailable
## Priority Categories (in order)

1. **Priority (P/0)** - Critical priority PRs that need immediate attention
2. **Milestoned** - PRs assigned to SR3, SR4, or Servicing milestones
Copy link
Member

Choose a reason for hiding this comment

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

@copilot the milestone will change every month. They will advance by one each month so this needs tp be dynamic

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated in commit b1e72f9. The documentation now describes dynamic milestone sorting ("sorted by lowest SR number first, e.g., SR5 before SR6") instead of hardcoded SR3, SR4 references. The script already handled this dynamically via the Get-MilestonePriority function which extracts and compares SR numbers.

Copilot AI requested a review from PureWeen January 6, 2026 14:41
@PureWeen PureWeen marked this pull request as ready for review January 6, 2026 15:58
Copilot AI review requested due to automatic review settings January 6, 2026 15:58
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 adds a new find-reviewable-pr skill that helps identify open pull requests in the dotnet/maui and dotnet/docs-maui repositories that are good candidates for review. The skill includes a PowerShell script that queries GitHub and prioritizes PRs based on multiple criteria including milestones (with dynamic SR number sorting), P/0 priority labels, partner/community status, and recency.

Key changes:

  • Adds comprehensive PR discovery and prioritization functionality with support for both maui and docs-maui repositories
  • Implements intelligent milestone sorting (SR5 before SR6) and multiple category-based filtering options
  • Provides three output formats (review, table, JSON) with configurable limits and filtering by platform or author

Reviewed changes

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

File Description
.github/skills/find-reviewable-pr/SKILL.md Comprehensive documentation including usage guide, priority categories, script parameters, and workflow instructions for finding and reviewing PRs
.github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1 PowerShell script implementing PR query logic with retry mechanism, prioritization algorithms, platform/author filtering, and multiple output formats

Comment on lines +501 to +504
}, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt -Descending
$communityPRs = $processedPRs | Where-Object { $_.IsCommunity } | Sort-Object {
Get-MilestonePriority $_.Milestone
}, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt -Descending
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The sorting logic for partner and community PRs appears inconsistent. These lines sort by milestone priority, then P/0 status, and then by CreatedAt in descending order (newest first). However, this means newer PRs appear before older ones within the same priority level, which may not be the intended behavior for long-waiting PRs.

Consider whether partner and community PRs should sort CreatedAt in ascending order (oldest first) to prioritize PRs that have been waiting longer, which would be more consistent with the milestoned and priority PR sorting.

Suggested change
}, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt -Descending
$communityPRs = $processedPRs | Where-Object { $_.IsCommunity } | Sort-Object {
Get-MilestonePriority $_.Milestone
}, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt -Descending
}, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt
$communityPRs = $processedPRs | Where-Object { $_.IsCommunity } | Sort-Object {
Get-MilestonePriority $_.Milestone
}, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt

Copilot uses AI. Check for mistakes.
ProjectStatus = Get-ProjectStatus -pr $pr
IsPartner = ($labelNames -match "partner/")
IsCommunity = ($labelNames -match "community")
IsPriority = ($labelNames -match "p/0" -or $labelNames -match "pri0" -or $labelNames -match "priority")
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The priority detection logic for docs-maui PRs is inconsistent with maui PRs. For maui PRs (line 423), only "p/0" labels are checked, but for docs-maui PRs, the script also checks for "pri0" and "priority" labels. This inconsistency could lead to confusion about which labels are considered priority.

Consider either:

  1. Using the same priority label detection logic for both repositories, or
  2. Documenting this difference in the SKILL.md file to explain why docs-maui uses different priority labels.
Suggested change
IsPriority = ($labelNames -match "p/0" -or $labelNames -match "pri0" -or $labelNames -match "priority")
IsPriority = ($labelNames -match "p/0")

Copilot uses AI. Check for mistakes.
Comment on lines +742 to +755
function Format-Table-Output {
Write-Host ""
Write-Host "Reviewable PRs" -ForegroundColor Cyan
Write-Host ("=" * 100)

$processedPRs | Select-Object -First ($Limit * 2) | Format-Table -Property @(
@{Label="PR"; Expression={$_.Number}; Width=6},
@{Label="Title"; Expression={ if ($_.Title.Length -gt 40) { $_.Title.Substring(0,37) + "..." } else { $_.Title } }; Width=40},
@{Label="Platform"; Expression={$_.Platform}; Width=10},
@{Label="Milestone"; Expression={$_.Milestone}; Width=15},
@{Label="Age"; Expression={"$($_.Age)d"}; Width=5},
@{Label="Files"; Expression={$_.Files}; Width=5}
) -AutoSize
}
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The Format-Table-Output function only displays PRs from the maui repository and does not include docs-maui PRs. This is inconsistent with the Format-Review-Output and Format-Json-Output functions, which both include docs-maui PRs. Users expecting to see all reviewable PRs in table format will miss documentation PRs.

Consider updating Format-Table-Output to include docs-maui PRs to maintain consistency across all output formats.

Copilot uses AI. Check for mistakes.
}

# Return processed PRs for pipeline usage (only when not in review mode)
if ($OutputFormat -ne "review") {
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The return statement only returns PRs from the maui repository (processedPRs) when OutputFormat is not "review", but does not include docs-maui PRs (processedDocsMauiPRs). This is inconsistent with the JSON output format which includes both. Pipeline consumers expecting to programmatically access all reviewable PRs will not receive docs-maui PRs.

Consider returning both processedPRs and processedDocsMauiPRs for pipeline usage, possibly as a hashtable with separate keys for each repository.

Suggested change
if ($OutputFormat -ne "review") {
if ($OutputFormat -ne "review") {
if ($null -ne $processedDocsMauiPRs) {
return @{
Maui = $processedPRs
DocsMaui = $processedDocsMauiPRs
}
}

Copilot uses AI. Check for mistakes.
Comment on lines +89 to +91
# Calculate date for "recent" filter (2 weeks ago)
$twoWeeksAgo = (Get-Date).AddDays(-14).ToString("yyyy-MM-dd")

Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The variable $twoWeeksAgo is calculated on line 90 but is never used in the script. The recent PR filtering logic on lines 506-507 uses $_.Age -le 14 directly instead of referencing this variable. This unused variable should be removed to avoid confusion and improve code maintainability.

Suggested change
# Calculate date for "recent" filter (2 weeks ago)
$twoWeeksAgo = (Get-Date).AddDays(-14).ToString("yyyy-MM-dd")

Copilot uses AI. Check for mistakes.
Comment on lines +2 to +44
<#
.SYNOPSIS
Finds open PRs in dotnet/maui and dotnet/docs-maui that are good candidates for review.

.DESCRIPTION
This script queries GitHub for open PRs and prioritizes them by:
1. Milestoned PRs (dynamically sorted by SR number - lower numbers first, e.g., SR5 before SR6)
2. P/0 labeled PRs (critical priority)
3. Recent PRs (5 from maui + 5 from docs-maui by default)
4. Partner PRs (Syncfusion, etc.)
5. Community PRs (external contributions)
6. docs-maui PRs (5 priority + 5 recent by default)

.PARAMETER Category
Filter by category: "milestoned", "priority", "recent", "partner", "community", "docs-maui", "all"

.PARAMETER Platform
Filter by platform: "android", "ios", "windows", "maccatalyst", "all"

.PARAMETER Limit
Maximum number of PRs to return per category (default: 10)

.PARAMETER RecentLimit
Maximum number of recent PRs to return from maui (default: 5)

.PARAMETER DocsLimit
Maximum number of docs-maui PRs to return per sub-category (priority/recent) (default: 5)

.PARAMETER OutputFormat
Output format: "table", "json", "review" (default: "review")

.EXAMPLE
./query-reviewable-prs.ps1
# Returns prioritized PRs across all categories including 5 recent from maui and 5 from docs-maui

.EXAMPLE
./query-reviewable-prs.ps1 -Category milestoned -Platform android
# Returns milestoned Android PRs only

.EXAMPLE
./query-reviewable-prs.ps1 -Category docs-maui
# Returns only docs-maui PRs
#>
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

The script's comment-based help (lines 2-44) does not document the ExcludeAuthors and IncludeAuthors parameters, even though they are defined in the param block (lines 68-72) and documented in SKILL.md. PowerShell's Get-Help cmdlet will not display these parameters without proper documentation in the script header.

Add .PARAMETER documentation for both ExcludeAuthors and IncludeAuthors to the comment-based help section, including examples showing how to use them.

Copilot uses AI. Check for mistakes.
try {
# Reset LASTEXITCODE before running command
$global:LASTEXITCODE = 0
$result = Invoke-Expression $Command 2>&1
Copy link

Copilot AI Jan 6, 2026

Choose a reason for hiding this comment

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

Using Invoke-Expression to execute the GitHub CLI command on line 107 can pose a security risk if the Command parameter contains untrusted input. While the current usage appears safe since the commands are constructed internally, consider using the call operator (&) with properly split arguments instead of Invoke-Expression to avoid potential command injection vulnerabilities.

For example, consider refactoring to pass the command as an array of arguments that can be splatted with the call operator, or use Start-Process with explicit argument parsing.

Suggested change
$result = Invoke-Expression $Command 2>&1
# Tokenize the command string into executable and arguments to avoid Invoke-Expression
$parseErrors = $null
$tokens = [System.Management.Automation.PSParser]::Tokenize($Command, [ref]$parseErrors)
if ($parseErrors -and $parseErrors.Count -gt 0) {
throw "Failed to parse command for $Description`: $Command"
}
$argList = @()
foreach ($token in $tokens) {
if ($token.Type -eq 'Command' -or $token.Type -eq 'CommandArgument' -or $token.Type -eq 'String') {
$argList += $token.Content
}
}
if ($argList.Count -eq 0) {
throw "Empty command provided for $Description"
}
$exe = $argList[0]
$args = @()
if ($argList.Count -gt 1) {
$args = $argList[1..($argList.Count - 1)]
}
$result = & $exe @args 2>&1

Copilot uses AI. Check for mistakes.
Updated all [DateTime]::Parse calls to use [System.Globalization.CultureInfo]::InvariantCulture when parsing PR createdAt and updatedAt fields. This ensures consistent date parsing regardless of system locale.
@kubaflo
Copy link
Contributor

kubaflo commented Jan 16, 2026

Screenshot 2026-01-16 at 23 28 00

@PureWeen PureWeen merged commit eeb54f2 into main Jan 16, 2026
2 of 3 checks passed
@PureWeen PureWeen deleted the copilot/grab-find-reviewable-pr-skill branch January 16, 2026 22:59
simonrozsival pushed a commit that referenced this pull request Jan 20, 2026
Adds the `find-reviewable-pr` skill from <a
href="https://github.com/PureWeen/maui/pull/9">PureWeen/maui PR #9</a>
to help find open PRs in the dotnet/maui and dotnet/docs-maui
repositories that are good candidates for review.

## Changes Made

- **`.github/skills/find-reviewable-pr/SKILL.md`** - Skill documentation
including usage guide, priority categories, script parameters, and
workflow for reviewing PRs
-
**`.github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1`**
- PowerShell script that queries GitHub for open PRs and prioritizes
them dynamically by milestone (lower SR numbers first), P/0 priority,
partner status, community contributions, and recency

## Features

The skill provides:
- Priority-based PR categorization (P/0, Milestoned, Partner, Community,
Recent)
- **Dynamic milestone sorting**: Milestones are sorted by SR number
(e.g., SR5 before SR6) so prioritization remains correct as milestones
advance monthly
- Platform filtering (Android, iOS, Windows, MacCatalyst)
- Multiple output formats (review, table, JSON)
- Complexity assessment for PRs
- Review status tracking
- **docs-maui support**: Returns 5 priority PRs and 5 recent PRs from
dotnet/docs-maui by default
  - New `-DocsLimit` parameter to control docs-maui PR count
  - New `-Category docs-maui` filter option to show only docs-maui PRs
- **Recent PRs**: Shows 5 recent PRs from both maui and docs-maui by
default
- New `-RecentLimit` parameter to control recent PRs from maui (default:
5)

<!-- START COPILOT ORIGINAL PROMPT -->



<details>

<summary>Original prompt</summary>

> Create a PR that just grabs the find-reviewable-pr's skill from this
PR PureWeen#9


</details>



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

---------

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: PureWeen <[email protected]>
Co-authored-by: Shane Neuville <[email protected]>
Co-authored-by: Jakub Florkowski <[email protected]>
@kubaflo kubaflo added the area-ai-agents Copilot CLI agents, agent skills, AI-assisted development label Jan 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-ai-agents Copilot CLI agents, agent skills, AI-assisted development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants