-
Notifications
You must be signed in to change notification settings - Fork 4
🪲 [Fix]: Fixes to app installations on enterprise organizations #437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…ons for improved readability
…tionAppInstallation to correctly process multiple installations
There was a problem hiding this 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 refactors three PowerShell scripts to replace nested ForEach-Object
calls with explicit foreach
loops for improved readability and consistency.
- Switched inner loops from pipeline
ForEach-Object
toforeach
in all three scripts - Adjusted handling of API response installations to iterate through collections explicitly
- Ensured each returned item is constructed via its respective class constructor
Reviewed Changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/functions/private/Apps/GitHub Apps/Get-GitHubOrganizationAppInstallation.ps1 | Replaced inner ForEach-Object with foreach loop |
src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1 | Replaced single-object constructor with loop over installations |
src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1 | Replaced inner ForEach-Object with foreach loop |
Comments suppressed due to low confidence (1)
src/functions/private/Apps/GitHub Apps/Get-GitHubEnterpriseOrganizationAppInstallation.ps1:60
- Previously a
GitHubAppInstallation
was constructed from the entireResponse
; now onlyResponse.installations
items are used. Verify this change doesn’t omit required metadata from the root response.
Invoke-GitHubAPI @inputObject | ForEach-Object {
src/functions/private/Apps/GitHub Apps/Get-GitHubOrganizationAppInstallation.ps1
Show resolved
Hide resolved
src/functions/private/Apps/GitHub Apps/Get-GitHubAppInstallableOrganization.ps1
Show resolved
Hide resolved
…nd type parameters for improved installation handling
- Created TEMPLATE.ps1 for structuring Pester tests. - Added Teams.Tests.ps1 to test GitHub Teams API functionalities. - Implemented Users.Tests.ps1 for user-related API tests. - Developed Variables.Tests.ps1 to validate GitHub variable management. - Introduced Apps.Tests.ps1 for testing GitHub Apps API endpoints. - Each test file includes setup and teardown logic, context management, and various test cases for different authentication types and scenarios.
…nd enhance assertions in Apps.Tests
…nd add enterprise-specific assertions
…syntax for skipping enterprise tests
… assertions in Apps.Tests
…nizations in Apps.Tests
…all in Apps.Tests
…r type and improve readability in Apps.Tests
…allations by owner name and type
- Created TEMPLATE.ps1 for standardized test structure using Pester. - Implemented Teams.Tests.ps1 to test GitHub Teams API functionalities including team creation, retrieval, updating, and deletion. - Developed Users.Tests.ps1 to validate user-related API calls such as fetching user details and updating user information. - Added Variables.Tests.ps1 to test GitHub variable management, including setting, updating, and removing variables for organizations and repositories.
…r types in various test files
…owner type condition
Module GitHub - 0.31.7 published to the PowerShell Gallery. |
GitHub release for GitHub v0.31.7 has been created. |
Description
This pull request introduces several fixes to improve the handling of GitHub App installations and related functionality. The updates include adding a new constructor for
GitHubAppInstallation
, refining object iteration in private functions, and aligning property names in public functions for consistency.Enhancements to
GitHubAppInstallation
class:GitHubAppInstallation
class to support initialization with additional parameters, includingTarget
andType
. This allows for more detailed and flexible object creation.Updates to private functions for object iteration:
ForEach-Object
with explicitforeach
loops inGet-GitHubAppInstallableOrganization
, improving readability and maintainability of the code.Get-GitHubEnterpriseOrganizationAppInstallation
to use the newGitHubAppInstallation
constructor, enabling the inclusion ofOrganization
andType
parameters for installations.Get-GitHubOrganizationAppInstallation
to useforeach
loops for better clarity and aligned it with the new constructor forGitHubAppInstallation
.Consistency improvements in public functions:
Connect-GitHubApp
to use theTarget
property instead ofaccount.slug
forInstallationName
andEnterprise
, ensuring consistent property naming. Additionally, fixed a casing issue for theName
property.Type of change
Checklist