Repository navigation
[release/10.0] Fix multi-org GitHub App installation selection - #17440
Merged
missymessa merged 1 commit intoAug 31, 2026
Merged
missymessa merged 1 commit into
missymessa merged 1 commit into
Conversation
Backport of dotnet#17402. Co-authored-by: Copilot <[email protected]> Copilot-Session: c08e3391-52d8-42e3-ad8c-ef2e5be92291
Contributor
There was a problem hiding this comment.
Pull request overview
Backports a fix to Get-GitHubAppToken.ps1 to correctly select the intended GitHub App installation when the App is installed in multiple organizations by flattening paginated Invoke-RestMethod responses before owner filtering.
Changes:
- Accumulate installations by explicitly enumerating each
Invoke-RestMethodpage response into a list (avoids nested top-level array behavior). - Track page size via a per-page enumeration count to drive pagination (
while count == 100).
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
115
to
119
| do { | ||
| # Assign the response before wrapping it in @(). PowerShell otherwise | ||
| # preserves a top-level JSON array as one nested pipeline object. | ||
| $pageResponse = Invoke-RestMethod ` | ||
| -Uri "https://api.github.com/app/installations?per_page=100&page=$page" ` | ||
| -Headers $headers ` | ||
| -Method Get |
mmitche
approved these changes
Aug 28, 2026
This was referenced Sep 1, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport of #17402.
The release branch still wraps the Invoke-RestMethod response with @(), which can retain a top-level installation array as one nested object. Explicitly enumerate each response so owner filtering selects the requested GitHub App installation.
Validation:
Tracking: AB#11966