-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Add find-reviewable-pr skill from existing PR #33349
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
@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 |
Co-authored-by: PureWeen <[email protected]>
Added the find-reviewable-pr skill from your branch in commit f53ef7f. This includes:
|
|
@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 |
Co-authored-by: PureWeen <[email protected]>
Added docs-maui support in commit 7520333. The script now:
|
|
@copilot show 5 recent from maui and docs |
Co-authored-by: PureWeen <[email protected]>
|
@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 ( pwsh .github/skills/find-reviewable-pr/scripts/query-reviewable-prs.ps1Example output: To test it locally, run with authenticated GitHub CLI. |
|
@copilot cant you pass in your token? |
I don't have access to a GitHub token in my environment - |
- 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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
Co-authored-by: PureWeen <[email protected]>
There was a problem hiding this 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 |
| }, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt -Descending | ||
| $communityPRs = $processedPRs | Where-Object { $_.IsCommunity } | Sort-Object { | ||
| Get-MilestonePriority $_.Milestone | ||
| }, { if ($_.IsPriority) { 0 } else { 1 } }, CreatedAt -Descending |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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.
| }, { 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 |
| 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") |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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:
- Using the same priority label detection logic for both repositories, or
- Documenting this difference in the SKILL.md file to explain why docs-maui uses different priority labels.
| IsPriority = ($labelNames -match "p/0" -or $labelNames -match "pri0" -or $labelNames -match "priority") | |
| IsPriority = ($labelNames -match "p/0") |
| 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 | ||
| } |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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.
| } | ||
|
|
||
| # Return processed PRs for pipeline usage (only when not in review mode) | ||
| if ($OutputFormat -ne "review") { |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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.
| if ($OutputFormat -ne "review") { | |
| if ($OutputFormat -ne "review") { | |
| if ($null -ne $processedDocsMauiPRs) { | |
| return @{ | |
| Maui = $processedPRs | |
| DocsMaui = $processedDocsMauiPRs | |
| } | |
| } |
| # Calculate date for "recent" filter (2 weeks ago) | ||
| $twoWeeksAgo = (Get-Date).AddDays(-14).ToString("yyyy-MM-dd") | ||
|
|
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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.
| # Calculate date for "recent" filter (2 weeks ago) | |
| $twoWeeksAgo = (Get-Date).AddDays(-14).ToString("yyyy-MM-dd") |
| <# | ||
| .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 | ||
| #> |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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.
| try { | ||
| # Reset LASTEXITCODE before running command | ||
| $global:LASTEXITCODE = 0 | ||
| $result = Invoke-Expression $Command 2>&1 |
Copilot
AI
Jan 6, 2026
There was a problem hiding this comment.
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.
| $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 |
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.
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]>

Adds the
find-reviewable-prskill 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 recencyFeatures
The skill provides:
-DocsLimitparameter to control docs-maui PR count-Category docs-mauifilter option to show only docs-maui PRs-RecentLimitparameter to control recent PRs from maui (default: 5)Original prompt
💡 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.