Created
January 18, 2026 02:19
-
-
Save dfinke/97d3f4ced74e5a10912667c9e69e5f14 to your computer and use it in GitHub Desktop.
Triggering GitHub Coding Agent from the Windows Terminal
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| param( | |
| [Parameter(Mandatory = $true)] | |
| [string]$Title, | |
| [Parameter(Mandatory = $true)] | |
| [string]$Description | |
| ) | |
| Write-Host "Starting issue creation and assignment process..." -ForegroundColor Green | |
| # Check if current directory is a Git repository | |
| Write-Host "Checking if current directory is a Git repository..." -ForegroundColor Yellow | |
| try { | |
| git status > $null 2>&1 | |
| if ($LASTEXITCODE -ne 0) { throw } | |
| } | |
| catch { | |
| Write-Error "Current directory is not a Git repository." | |
| exit 1 | |
| } | |
| Write-Host "Git repository confirmed." -ForegroundColor Green | |
| # Get the GitHub repository owner and name from the current directory's git remote | |
| Write-Host "Retrieving repository owner and name from remote..." -ForegroundColor Cyan | |
| $remoteUrl = git remote get-url origin | |
| $parts = $remoteUrl -split '/' | |
| $Owner = $parts[-2] | |
| $Repo = $parts[-1] -replace '\.git$' | |
| Write-Host "Parsed Owner: $Owner, Repo: $Repo" -ForegroundColor Cyan | |
| # Create the issue using GitHub CLI | |
| Write-Host "Creating issue with title: '$Title'..." -ForegroundColor Blue | |
| $issueOutput = gh issue create --title $Title --body $Description --repo "$Owner/$Repo" | |
| # Extract the issue number from the output URL | |
| $issueUrl = $issueOutput.Trim() | |
| $IssueNumber = ($issueUrl -split '/')[-1] | |
| Write-Host "Issue created successfully. URL: $issueUrl" -ForegroundColor Green | |
| Write-Host "Extracted issue number: $IssueNumber" -ForegroundColor Cyan | |
| # Assign Copilot to the newly created issue | |
| Write-Host "Assigning @copilot to issue #$IssueNumber..." -ForegroundColor Blue | |
| gh issue edit $IssueNumber --repo "$Owner/$Repo" --add-assignee "@copilot" | |
| Write-Host "Assignment complete." -ForegroundColor Green |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment