Skip to content

🚀 [Feature]: GitHub App connections now support parallel processing#519

Open
Marius Storhaug (MariusStorhaug) wants to merge 76 commits intomainfrom
parallelConnect
Open

🚀 [Feature]: GitHub App connections now support parallel processing#519
Marius Storhaug (MariusStorhaug) wants to merge 76 commits intomainfrom
parallelConnect

Conversation

@MariusStorhaug
Copy link
Copy Markdown
Member

@MariusStorhaug Marius Storhaug (MariusStorhaug) commented Sep 17, 2025

Connecting to multiple GitHub App installations can now be done in parallel, significantly reducing wait time for environments with many installations. A new -ThrottleLimit parameter controls the degree of parallelism, and installation objects can be piped directly into the connection function.

New: Parallel app installation connections

Connect-GitHubApp now processes multiple installations in parallel using PowerShell's ForEach-Object -Parallel. Use the new -ThrottleLimit parameter to control how many installations are connected simultaneously.

# Connect all installations in parallel (default throttle limit)
Connect-GitHubApp

# Control parallelism
Connect-GitHubApp -ThrottleLimit 10

# Pipe specific installations
Get-GitHubAppInstallation | Where-Object { $_.Account.Login -eq 'MyOrg' } | Connect-GitHubApp

New: Pipeline input for installations

Installation objects from Get-GitHubAppInstallation can now be piped directly to Connect-GitHubApp, enabling selective connection to specific installations without filtering inside the function.

Changed: Retry logic for transient failures

Connection creation now includes retry logic to handle transient failures when generating access tokens, improving reliability in high-volume scenarios.

Technical Details

  • Connect-GitHubApp: Added -ThrottleLimit parameter and ForEach-Object -Parallel processing for all installations, filtered targets, and piped installation objects.
  • New parameter sets support pipeline input for GitHubAppInstallation objects.
  • Retry logic added to context object creation to handle transient API failures.
  • Various class files updated: GitHubApp, GitHubAppInstallation, GitHubAppContext, GitHubPlan, GitHubOwner and subtypes, and several private/public functions.
  • .github/PSModule.yml updated to adjust CI workflow settings.

- Created TEMPLATE.ps1 for Pester tests with a template structure.
- Added Teams.Tests.ps1 to test GitHub Teams API functionalities including team creation, retrieval, updating, and deletion.
- Introduced Users.Tests.ps1 to validate user-related API calls, including user retrieval and updates.
- Implemented Variables.Tests.ps1 to manage GitHub repository variables, including setting, updating, and removing variables.
Copy link
Copy Markdown
Contributor

Copilot AI left a 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 enhances the Connect-GitHubApp function to support parallel processing of GitHub App installation connections, significantly improving performance when connecting to multiple installations. The changes introduce new parameter sets for handling pipeline input and parallel execution controls.

  • Added parallel processing capabilities using ForEach-Object -Parallel with configurable throttle limits
  • Introduced new parameter set for accepting installation objects from pipeline input
  • Added retry logic for context creation to improve reliability

Reviewed Changes

Copilot reviewed 2 out of 17 changed files in this pull request and generated 4 comments.

File Description
src/functions/public/Auth/Connect-GitHubApp.ps1 Major refactoring to support parallel processing, new parameter sets, and recursive connections to installations
.github/PSModule.yml Configuration updates to skip various test components in CI workflows

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…reation and removing unnecessary Write-Host statements in Connect-GitHubApp
…GitHubPermission class with equality and hash code methods
…ion comparison logic in GitHubAppInstallation class
…n GitHubAppContext and GitHubAppInstallationContext
…ppContext and streamline app property initialization
…t-GitHubAppInstallationForAuthenticatedAppAsList function
…lude URL, enhancing object creation efficiency across multiple functions.
…include App context, improving object creation clarity in installation retrieval functions.
…lly assign App object, improving flexibility in object creation. Update GitHubUser constructor to use null coalescing for bio and ensure direct assignment for followers and following properties.
… improved parallel processing of installations. Update context handling to utilize using scope for better variable access in parallel execution.
…use the correct module name, ensuring compatibility with the latest module structure.
… module context, improving module management and accessibility.
… variables for improved parallel processing and module version handling.
…cted installations for improved parallel processing in Connect-GitHubApp.
…ntext parameter handling in Connect-GitHubApp for enhanced performance.
…arameters to improve clarity and maintainability in Connect-GitHubApp.
…ext parameter handling for improved clarity and performance in Connect-GitHubApp.
…or revoking installation access tokens in GitHub App.

🚀 [Add]: Create Resolve-GitHubContext filter to resolve context into GitHubContext object for improved context handling.
🚀 [Add]: Introduce Set-GitHubContext function to set and store GitHub context in the vault for API authentication.
🚀 [Update]: Enhance Disconnect-GitHubAccount function to support wildcard context resolution for improved usability.
🚀 [Add]: Add Get-GitHubToken function to retrieve GitHub tokens from environment variables as plaintext or secure string.
…tallations for improved parallel processing in Connect-GitHubApp.
…r improved clarity in end processing of Connect-GitHubApp.
…t for controlling parallel thread usage during disconnection.
… removal from the vault with support for single and multiple contexts.
…ailed output for GitHub app, configuration, and installation details.
… for enhanced debugging and logging during installation context.
…r pipeline usage in Connect-GitHubApp function.
…unctions to support multi-string and wildcard context resolution.
…ort-Object for unique sorting and improve debug output.
@MariusStorhaug Marius Storhaug (MariusStorhaug) changed the title 🩹 [Patch]: Optimize Connect-GitHubApp and use parallel processing of access tokens 🚀 [Feature]: GitHub App connections now support parallel processing Apr 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Optimize Connect-GitHubApp with parallel access token processing

2 participants