Repository navigation
Replace branch-mirror-status prompt file with PowerShell script - #55111
Conversation
Replace the prompt file with a standalone PowerShell script that checks whether public GitHub release branches have been mirrored to internal Azure DevOps repos. Key fix from original PR #53982: use Invoke-RestMethod with an explicit token from 'az account get-access-token' instead of 'az rest', which fails on Windows due to: 1. Token acquisition issues (can't derive resource from AzDo URLs) 2. Unicode encoding errors ('charmap' codec) Co-authored-by: Copilot <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR replaces the .github/prompts/branch-mirror-status.prompt.md prompt (VS/VS Code-specific and deterministic) with a standalone PowerShell script that produces the same “branch mirror status” report by querying GitHub (via gh) and Azure DevOps (via az + Invoke-RestMethod).
Changes:
- Added
eng/Get-BranchMirrorStatus.ps1to compute and emit a markdown table of mirror status for configured release branches. - Removed
.github/prompts/branch-mirror-status.prompt.mdnow that the check is implemented as an executable script.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eng/Get-BranchMirrorStatus.ps1 | New script that checks latest GitHub commit per release branch and verifies it’s present/mirrored in AzDo, emitting markdown output. |
| .github/prompts/branch-mirror-status.prompt.md | Removed the deterministic prompt file in favor of the standalone script. |
|
@lbussell I noticed your other PR went stale and had my local copilot try to fix the scripts. It apparently didn't have access to your branch so created it's own PR. this script works for me. |
- Add [ValidateRange(1, MaxValue)] to SearchDepth parameter - Remove 2>&1 from az token call to avoid stderr corruption - Add --only-show-errors and .Trim() for clean token capture Co-authored-by: Copilot <[email protected]>
…reCategory: InfrastructureError) Co-authored-by: Copilot <[email protected]>
…I URL Co-authored-by: Copilot <[email protected]>
mthalman
left a comment
There was a problem hiding this comment.
Note
This review comment was generated with AI assistance.
One formatting bug found in the Markdown table escaping. Verified by running Format-TableCell locally.
The pipe character is unlikely to appear in commit messages or branch names, so the defensive escaping is not needed. Co-authored-by: Copilot <[email protected]>
Co-authored-by: Copilot <[email protected]>
Supersedes #53982.
Replaces the
branch-mirror-status.prompt.mdprompt file with a standalone PowerShell script that checks whether public GitHub release branches have been mirrored to internal Azure DevOps repos.Fix from #53982
The original PR used
az rest --resourcefor AzDo API calls, which fails on Windows due to:az restcan't properly derive the Azure AD resource from AzDo URLs, causing it to skip authenticationaz resthits'charmap' codec can't encode characterwhen the response contains non-ASCII characters on WindowsFix: Use
az account get-access-token --resource <id>to acquire the bearer token once during prerequisite checks, thenInvoke-RestMethodwith the token in headers for all AzDo API calls.Usage
Example Output