GitHub Skill
Use these scripts instead of raw gh commands for consistent error handling and structured output.
Triggers
| Phrase |
Operation |
get PR context for #123 |
Get-PRContext.ps1 |
respond to review comments |
Post-PRCommentReply.ps1 |
check CI status |
Get-PRChecks.ps1 |
add label to issue |
Set-IssueLabels.ps1 |
assign milestone |
Set-ItemMilestone.ps1 |
Decision Tree
Need GitHub data?
├─ List PRs (filtered) → Get-PullRequests.ps1
├─ PR info/diff → Get-PRContext.ps1
├─ CI check status → Get-PRChecks.ps1
├─ CI failure logs → Get-PRCheckLogs.ps1
├─ Review comments → Get-PRReviewComments.ps1
├─ Review threads → Get-PRReviewThreads.ps1
├─ Unique reviewers → Get-PRReviewers.ps1
├─ Unaddressed bot comments → Get-UnaddressedComments.ps1
├─ PR merged check → Test-PRMerged.ps1
├─ Copilot follow-up PRs → Detect-CopilotFollowUpPR.ps1
├─ Issue info → Get-IssueContext.ps1
├─ Merge readiness check → Test-PRMergeReady.ps1
├─ Latest milestone → Get-LatestSemanticMilestone.ps1
└─ Need to take action?
├─ Create issue → New-Issue.ps1
├─ Create PR → New-PR.ps1
├─ Reply to review → Post-PRCommentReply.ps1
├─ Reply to thread (GraphQL) → Add-PRReviewThreadReply.ps1
├─ Comment on issue → Post-IssueComment.ps1
├─ Add reaction → Add-CommentReaction.ps1
├─ Apply labels → Set-IssueLabels.ps1
├─ Set issue milestone → Set-IssueMilestone.ps1
├─ Set PR/issue milestone (auto-detect) → Set-ItemMilestone.ps1
├─ Assign issue → Set-IssueAssignee.ps1
├─ Resolve threads → Resolve-PRReviewThread.ps1
├─ Process AI triage → Invoke-PRCommentProcessing.ps1
├─ Assign Copilot → Invoke-CopilotAssignment.ps1
├─ Enable/disable auto-merge → Set-PRAutoMerge.ps1
├─ Close PR → Close-PR.ps1
└─ Merge PR → Merge-PR.ps1
Script Reference
PR Operations (scripts/pr/)
| Script |
Purpose |
Key Parameters |
Get-PullRequests.ps1 |
List PRs with filters |
-State, -Label, -Author, -Base, -Head, -Limit |
Get-PRContext.ps1 |
PR metadata, diff, files |
-PullRequest, -IncludeChangedFiles, -IncludeDiff |
Get-PRChecks.ps1 |
CI check status, polling |
-PullRequest, -Wait, -TimeoutSeconds, -RequiredOnly |
Get-PRCheckLogs.ps1 |
Fetch logs from failing CI checks |
-PullRequest, -MaxLines, -ContextLines |
Get-PRReviewComments.ps1 |
Paginated review comments |
-PullRequest, -IncludeIssueComments |
Get-PRReviewThreads.ps1 |
Thread-level review data |
-PullRequest, -UnresolvedOnly |
Get-PRReviewers.ps1 |
Enumerate unique reviewers |
-PullRequest, -ExcludeBots |
Get-UnaddressedComments.ps1 |
Bot comments needing attention |
-PullRequest |
Get-UnresolvedReviewThreads.ps1 |
Unresolved thread IDs |
-PullRequest |
Test-PRMerged.ps1 |
Check if PR is merged |
-PullRequest |
Detect-CopilotFollowUpPR.ps1 |
Detect Copilot follow-up PRs |
-PRNumber, -Owner, -Repo |
Post-PRCommentReply.ps1 |
Thread-preserving replies |
-PullRequest, -CommentId, -Body |
Add-PRReviewThreadReply.ps1 |
Reply to thread by ID (GraphQL) |
-ThreadId, -Body, -Resolve |
Resolve-PRReviewThread.ps1 |
Mark threads resolved |
-ThreadId or -PullRequest -All |
Unresolve-PRReviewThread.ps1 |
Mark threads unresolved |
-ThreadId or -PullRequest -All |
Get-ThreadById.ps1 |
Get single thread by ID |
-ThreadId |
Get-ThreadConversationHistory.ps1 |
Full thread comment history |
-ThreadId, -IncludeMinimized |
Test-PRMergeReady.ps1 |
Check merge readiness |
-PullRequest, -IgnoreCI, -IgnoreThreads |
Set-PRAutoMerge.ps1 |
Enable/disable auto-merge |
-PullRequest, -Enable/-Disable, -MergeMethod |
Invoke-PRCommentProcessing.ps1 |
Process AI triage output |
-PRNumber, -Verdict, -FindingsJson |
New-PR.ps1 |
Create PR with validation |
-Title, -Body, -Base |
Close-PR.ps1 |
Close PR with comment |
-PullRequest, -Comment |
Merge-PR.ps1 |
Merge with strategy |
-PullRequest, -Strategy, -DeleteBranch, -Auto |
Issue Operations (scripts/issue/)
| Script |
Purpose |
Key Parameters |
Get-IssueContext.ps1 |
Issue metadata |
-Issue |
New-Issue.ps1 |
Create new issue |
-Title, -Body, -Labels |
Set-IssueLabels.ps1 |
Apply labels (auto-create) |
-Issue, -Labels, -Priority |
Set-IssueMilestone.ps1 |
Assign milestone |
-Issue, -Milestone |
Post-IssueComment.ps1 |
Comments with idempotency |
-Issue, -Body, -Marker |
Invoke-CopilotAssignment.ps1 |
Synthesize context for Copilot |
-IssueNumber, -WhatIf |
Set-IssueAssignee.ps1 |
Assign users to issues |
-Issue, -Assignees |
Milestone Operations (scripts/milestone/)
| Script |
Purpose |
Key Parameters |
Get-LatestSemanticMilestone.ps1 |
Detect latest semantic version milestone |
-Owner, -Repo |
Set-ItemMilestone.ps1 |
Assign milestone to PR/issue (auto-detect) |
-ItemType, -ItemNumber, -MilestoneTitle |
Reactions (scripts/reactions/)
| Script |
Purpose |
Key Parameters |
Add-CommentReaction.ps1 |
Add emoji reactions (batch support) |
-CommentId[], -Reaction, -CommentType |
Output Format
All scripts output structured JSON with Success boolean:
$result = pwsh -NoProfile scripts/pr/Get-PRContext.ps1 -PullRequest 50 | ConvertFrom-Json
if ($result.Success) { ... }
Process
This skill provides a toolkit of PowerShell scripts for GitHub operations. Use scripts directly or compose them into workflows.
Basic Usage:
- Identify the operation needed using the Decision Tree
- Find the corresponding script in the Script Reference
- Call the script with required parameters
- Parse the JSON output and check
Success field
Example Flow:
# Get PR context
$pr = pwsh scripts/pr/Get-PRContext.ps1 -PullRequest 123 | ConvertFrom-Json
# Check CI status
$checks = pwsh scripts/pr/Get-PRChecks.ps1 -PullRequest 123 | ConvertFrom-Json
# Add comment if needed
if ($checks.FailedCount -gt 0) {
pwsh scripts/pr/Post-PRCommentReply.ps1 -PullRequest 123 -Body "CI failures detected"
}
Anti-Patterns
| Avoid |
Why |
Instead |
Raw gh pr view commands |
No structured output |
Use Get-PRContext.ps1 |
Raw gh api for comments |
Doesn't preserve threading |
Use Post-PRCommentReply.ps1 |
| Replying to thread expecting auto-resolve |
Replies DON'T auto-resolve threads |
Use Resolve-PRReviewThread.ps1 after reply |
| Inline issue creation |
Missing validation |
Use New-Issue.ps1 |
| Multiple individual reactions |
88% slower |
Use batch mode in Add-CommentReaction.ps1 |
| Hardcoding owner/repo |
Breaks in forks |
Let scripts infer from git remote |
| Ignoring exit codes |
Missing error handling |
Check $LASTEXITCODE |
| Skipping idempotency markers |
Duplicate comments |
Use -Marker parameter |
See Also
| Document |
Content |
| examples.md |
Complete script examples |
| patterns.md |
Reusable workflow patterns |
| copilot-prompts.md |
Creating @copilot directives |
| copilot-synthesis-guide.md |
Copilot context synthesis |
| api-reference.md |
Exit codes, API endpoints, troubleshooting |
modules/GitHubCore.psm1 |
Shared helper functions |
Verification
Before completing a GitHub operation:
1---2name: github-243description: Execute GitHub operations (PRs, issues, milestones, labels, comments, merges) using PowerShell scripts with structured output and error handling. Use when working with pull requests, issues, review comments, CI checks, or milestones instead of raw gh.4license: MIT5---6# GitHub Skill78Use these scripts instead of raw `gh` commands for consistent error handling and structured output.910---1112## Triggers1314| Phrase | Operation |15|--------|-----------|16| `get PR context for #123` | Get-PRContext.ps1 |17| `respond to review comments` | Post-PRCommentReply.ps1 |18| `check CI status` | Get-PRChecks.ps1 |19| `add label to issue` | Set-IssueLabels.ps1 |20| `assign milestone` | Set-ItemMilestone.ps1 |2122---2324## Decision Tree2526```text27Need GitHub data?28├─ List PRs (filtered) → Get-PullRequests.ps129├─ PR info/diff → Get-PRContext.ps130├─ CI check status → Get-PRChecks.ps131├─ CI failure logs → Get-PRCheckLogs.ps132├─ Review comments → Get-PRReviewComments.ps133├─ Review threads → Get-PRReviewThreads.ps134├─ Unique reviewers → Get-PRReviewers.ps135├─ Unaddressed bot comments → Get-UnaddressedComments.ps136├─ PR merged check → Test-PRMerged.ps137├─ Copilot follow-up PRs → Detect-CopilotFollowUpPR.ps138├─ Issue info → Get-IssueContext.ps139├─ Merge readiness check → Test-PRMergeReady.ps140├─ Latest milestone → Get-LatestSemanticMilestone.ps141└─ Need to take action?42 ├─ Create issue → New-Issue.ps143 ├─ Create PR → New-PR.ps144 ├─ Reply to review → Post-PRCommentReply.ps145 ├─ Reply to thread (GraphQL) → Add-PRReviewThreadReply.ps146 ├─ Comment on issue → Post-IssueComment.ps147 ├─ Add reaction → Add-CommentReaction.ps148 ├─ Apply labels → Set-IssueLabels.ps149 ├─ Set issue milestone → Set-IssueMilestone.ps150 ├─ Set PR/issue milestone (auto-detect) → Set-ItemMilestone.ps151 ├─ Assign issue → Set-IssueAssignee.ps152 ├─ Resolve threads → Resolve-PRReviewThread.ps153 ├─ Process AI triage → Invoke-PRCommentProcessing.ps154 ├─ Assign Copilot → Invoke-CopilotAssignment.ps155 ├─ Enable/disable auto-merge → Set-PRAutoMerge.ps156 ├─ Close PR → Close-PR.ps157 └─ Merge PR → Merge-PR.ps158```5960---6162## Script Reference6364### PR Operations (`scripts/pr/`)6566| Script | Purpose | Key Parameters |67|--------|---------|----------------|68| `Get-PullRequests.ps1` | List PRs with filters | `-State`, `-Label`, `-Author`, `-Base`, `-Head`, `-Limit` |69| `Get-PRContext.ps1` | PR metadata, diff, files | `-PullRequest`, `-IncludeChangedFiles`, `-IncludeDiff` |70| `Get-PRChecks.ps1` | CI check status, polling | `-PullRequest`, `-Wait`, `-TimeoutSeconds`, `-RequiredOnly` |71| `Get-PRCheckLogs.ps1` | Fetch logs from failing CI checks | `-PullRequest`, `-MaxLines`, `-ContextLines` |72| `Get-PRReviewComments.ps1` | Paginated review comments | `-PullRequest`, `-IncludeIssueComments` |73| `Get-PRReviewThreads.ps1` | Thread-level review data | `-PullRequest`, `-UnresolvedOnly` |74| `Get-PRReviewers.ps1` | Enumerate unique reviewers | `-PullRequest`, `-ExcludeBots` |75| `Get-UnaddressedComments.ps1` | Bot comments needing attention | `-PullRequest` |76| `Get-UnresolvedReviewThreads.ps1` | Unresolved thread IDs | `-PullRequest` |77| `Test-PRMerged.ps1` | Check if PR is merged | `-PullRequest` |78| `Detect-CopilotFollowUpPR.ps1` | Detect Copilot follow-up PRs | `-PRNumber`, `-Owner`, `-Repo` |79| `Post-PRCommentReply.ps1` | Thread-preserving replies | `-PullRequest`, `-CommentId`, `-Body` |80| `Add-PRReviewThreadReply.ps1` | Reply to thread by ID (GraphQL) | `-ThreadId`, `-Body`, `-Resolve` |81| `Resolve-PRReviewThread.ps1` | Mark threads resolved | `-ThreadId` or `-PullRequest -All` |82| `Unresolve-PRReviewThread.ps1` | Mark threads unresolved | `-ThreadId` or `-PullRequest -All` |83| `Get-ThreadById.ps1` | Get single thread by ID | `-ThreadId` |84| `Get-ThreadConversationHistory.ps1` | Full thread comment history | `-ThreadId`, `-IncludeMinimized` |85| `Test-PRMergeReady.ps1` | Check merge readiness | `-PullRequest`, `-IgnoreCI`, `-IgnoreThreads` |86| `Set-PRAutoMerge.ps1` | Enable/disable auto-merge | `-PullRequest`, `-Enable`/`-Disable`, `-MergeMethod` |87| `Invoke-PRCommentProcessing.ps1` | Process AI triage output | `-PRNumber`, `-Verdict`, `-FindingsJson` |88| `New-PR.ps1` | Create PR with validation | `-Title`, `-Body`, `-Base` |89| `Close-PR.ps1` | Close PR with comment | `-PullRequest`, `-Comment` |90| `Merge-PR.ps1` | Merge with strategy | `-PullRequest`, `-Strategy`, `-DeleteBranch`, `-Auto` |9192### Issue Operations (`scripts/issue/`)9394| Script | Purpose | Key Parameters |95|--------|---------|----------------|96| `Get-IssueContext.ps1` | Issue metadata | `-Issue` |97| `New-Issue.ps1` | Create new issue | `-Title`, `-Body`, `-Labels` |98| `Set-IssueLabels.ps1` | Apply labels (auto-create) | `-Issue`, `-Labels`, `-Priority` |99| `Set-IssueMilestone.ps1` | Assign milestone | `-Issue`, `-Milestone` |100| `Post-IssueComment.ps1` | Comments with idempotency | `-Issue`, `-Body`, `-Marker` |101| `Invoke-CopilotAssignment.ps1` | Synthesize context for Copilot | `-IssueNumber`, `-WhatIf` |102| `Set-IssueAssignee.ps1` | Assign users to issues | `-Issue`, `-Assignees` |103104### Milestone Operations (`scripts/milestone/`)105106| Script | Purpose | Key Parameters |107|--------|---------|----------------|108| `Get-LatestSemanticMilestone.ps1` | Detect latest semantic version milestone | `-Owner`, `-Repo` |109| `Set-ItemMilestone.ps1` | Assign milestone to PR/issue (auto-detect) | `-ItemType`, `-ItemNumber`, `-MilestoneTitle` |110111### Reactions (`scripts/reactions/`)112113| Script | Purpose | Key Parameters |114|--------|---------|----------------|115| `Add-CommentReaction.ps1` | Add emoji reactions (batch support) | `-CommentId[]`, `-Reaction`, `-CommentType` |116117---118119## Output Format120121All scripts output structured JSON with `Success` boolean:122123```powershell124$result = pwsh -NoProfile scripts/pr/Get-PRContext.ps1 -PullRequest 50 | ConvertFrom-Json125if ($result.Success) { ... }126```127128---129130## Process131132This skill provides a toolkit of PowerShell scripts for GitHub operations. Use scripts directly or compose them into workflows.133134**Basic Usage:**1351361. Identify the operation needed using the Decision Tree1372. Find the corresponding script in the Script Reference1383. Call the script with required parameters1394. Parse the JSON output and check `Success` field140141**Example Flow:**142143```powershell144# Get PR context145$pr = pwsh scripts/pr/Get-PRContext.ps1 -PullRequest 123 | ConvertFrom-Json146147# Check CI status148$checks = pwsh scripts/pr/Get-PRChecks.ps1 -PullRequest 123 | ConvertFrom-Json149150# Add comment if needed151if ($checks.FailedCount -gt 0) {152 pwsh scripts/pr/Post-PRCommentReply.ps1 -PullRequest 123 -Body "CI failures detected"153}154```155156---157158## Anti-Patterns159160| Avoid | Why | Instead |161|-------|-----|---------|162| Raw `gh pr view` commands | No structured output | Use `Get-PRContext.ps1` |163| Raw `gh api` for comments | Doesn't preserve threading | Use `Post-PRCommentReply.ps1` |164| Replying to thread expecting auto-resolve | Replies DON'T auto-resolve threads | Use `Resolve-PRReviewThread.ps1` after reply |165| Inline issue creation | Missing validation | Use `New-Issue.ps1` |166| Multiple individual reactions | 88% slower | Use batch mode in `Add-CommentReaction.ps1` |167| Hardcoding owner/repo | Breaks in forks | Let scripts infer from `git remote` |168| Ignoring exit codes | Missing error handling | Check `$LASTEXITCODE` |169| Skipping idempotency markers | Duplicate comments | Use `-Marker` parameter |170171---172173## See Also174175| Document | Content |176|----------|---------|177| [examples.md](references/examples.md) | Complete script examples |178| [patterns.md](references/patterns.md) | Reusable workflow patterns |179| [copilot-prompts.md](references/copilot-prompts.md) | Creating @copilot directives |180| [copilot-synthesis-guide.md](references/copilot-synthesis-guide.md) | Copilot context synthesis |181| [api-reference.md](references/api-reference.md) | Exit codes, API endpoints, troubleshooting |182| `modules/GitHubCore.psm1` | Shared helper functions |183184---185186## Verification187188Before completing a GitHub operation:189190- [ ] Correct script selected from Decision Tree191- [ ] Required parameters provided (PR/issue number)192- [ ] Response JSON parsed successfully193- [ ] `Success: true` in response194- [ ] State change verified (for mutating operations)