Skip to content

Conversation

MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented Jun 25, 2025

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:

  • Added a new constructor to the GitHubAppInstallation class to support initialization with additional parameters, including Target and Type. This allows for more detailed and flexible object creation.

Updates to private functions for object iteration:

  • Replaced ForEach-Object with explicit foreach loops in Get-GitHubAppInstallableOrganization, improving readability and maintainability of the code.
  • Updated Get-GitHubEnterpriseOrganizationAppInstallation to use the new GitHubAppInstallation constructor, enabling the inclusion of Organization and Type parameters for installations.
  • Refined Get-GitHubOrganizationAppInstallation to use foreach loops for better clarity and aligned it with the new constructor for GitHubAppInstallation.

Consistency improvements in public functions:

  • Updated Connect-GitHubApp to use the Target property instead of account.slug for InstallationName and Enterprise, ensuring consistent property naming. Additionally, fixed a casing issue for the Name property.

Type of change

  • 📖 [Docs]
  • 🪲 [Fix]
  • 🩹 [Patch]
  • ⚠️ [Security fix]
  • 🚀 [Feature]
  • 🌟 [Breaking change]

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas

@Copilot Copilot AI review requested due to automatic review settings June 25, 2025 10:56
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner June 25, 2025 10:56
@MariusStorhaug MariusStorhaug self-assigned this Jun 25, 2025
Copy link
Contributor

@Copilot 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 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 to foreach 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 entire Response; now only Response.installations items are used. Verify this change doesn’t omit required metadata from the root response.
        Invoke-GitHubAPI @inputObject | ForEach-Object {

…nd type parameters for improved installation handling
@MariusStorhaug MariusStorhaug changed the title 🪲 [Fix]: Fix an issue with getting multiple app installation on enterprise organizations 🪲 [Fix]: Fixes to app installations on enterprise organizations Jun 25, 2025
- 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.
- 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.
@MariusStorhaug MariusStorhaug merged commit bfe8771 into main Jun 25, 2025
11 checks passed
@MariusStorhaug MariusStorhaug deleted the fixGetAppInstallations branch June 25, 2025 22:21
Copy link
Contributor

Module GitHub - 0.31.7 published to the PowerShell Gallery.

Copy link
Contributor

GitHub release for GitHub v0.31.7 has been created.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

1 participant