-
Notifications
You must be signed in to change notification settings - Fork 4
🩹 [Patch]: Add function to remove app installation as a GitHub App #483
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
- Created TEMPLATE.ps1 for structuring Pester tests with common setup. - Added Teams.Tests.ps1 to test GitHub Teams API functionalities including team creation, retrieval, updating, and deletion. - Implemented Users.Tests.ps1 to validate user-related API calls such as fetching user details and updating user information. - Developed Variables.Tests.ps1 to test GitHub repository and organization variable management, including setting, updating, and removing variables.
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 adds functionality for uninstalling GitHub App installations, along with test infrastructure and configuration changes. The main focus is implementing proper cleanup mechanisms for GitHub App installations in organization contexts.
- Implements
Remove-GitHubAppInstallation
private function for deleting app installations via API - Enhances
Uninstall-GitHubApp
public function with improved parameter handling and installation deletion logic - Adds comprehensive test coverage for app installation cleanup in organization lifecycle tests
Reviewed Changes
Copilot reviewed 4 out of 17 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
src/functions/private/Apps/GitHub Apps/Remove-GitHubAppInstallation.ps1 |
New private function implementing GitHub API call to delete app installations |
src/functions/public/Apps/GitHub App/Uninstall-GitHubApp.ps1 |
Enhanced parameter set handling and added default parameter set for installation deletion |
tests/Organizations.Tests.ps1 |
Added pre-test and post-test cleanup logic for app installations in organization tests |
.github/PSModule.yml |
Uncommented configuration to skip various test components and documentation builds |
Comments suppressed due to low confidence (1)
tests/Organizations.Tests.ps1:174
- The test assertion should include a descriptive message to make test failures more informative. Consider adding '-Because' parameter to explain what this assertion validates.
$remainingInstallations | Should -BeNullOrEmpty
src/functions/private/Apps/GitHub Apps/Remove-GitHubAppInstallation.ps1
Outdated
Show resolved
Hide resolved
…or uninstalling GitHub Apps
3a099c6
to
a9f8063
Compare
… enhance GitHubAppContext with TokenExpiresIn property
…n GitHub context formatting
… in GitHub context formatting
…ds in GitHub context formatting
…n GitHub context formatting
…HubUnsignedJWT function
…d 10 minutes for 'APP' in GitHub context formatting
…b App installations
…eOrganization function to clarify it uninstalls from enterprise-owned organizations
…parameter handling for improved clarity and functionality
…y in Uninstall-GitHubApp function
…p for improved context handling
…e parameter in Organizations.Tests.ps1
…handling in Uninstall-GitHubApp functions
- Created TEMPLATE.ps1 for structuring Pester tests with common setup. - 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. - Developed Variables.Tests.ps1 to test GitHub variable management, covering organization and repository scopes, variable creation, updates, and deletions.
- Revise README to include automatic token renewal details. - Remove JwtTimeTolerance from GitHubConfig and related formats. - Adjust JWT generation to use fixed expiration times. - Update token expiration checks in relevant functions. - Add tests for token expiration handling and emoji retrieval.
…ant comments 🪲 [Fix]: Update TokenExpiresIn property to return TimeSpan.Zero for expired tokens
…AppOnEnterpriseOrganization function
Module GitHub - 0.36.7 published to the PowerShell Gallery. |
GitHub release for GitHub v0.36.7 has been created. |
Description
This pull request introduces improvements to the GitHub App uninstallation workflow, adding more flexible and robust ways to uninstall apps both as an authenticated app and as an enterprise installation. The changes include new internal functions, enhanced parameter handling, improved context validation, and expanded test coverage to ensure reliability and clarity in uninstall scenarios.
Enhancements to GitHub App Uninstallation:
Uninstall-GitHubAppAsApp
to support uninstalling app installations as the authenticated app, with support for confirmation and verbose output.Uninstall-GitHubAppOnEnterpriseOrganization
to clarify its purpose, improve parameter validation, add confirmation support, and provide better feedback on successful uninstalls.Expanded and Flexible Public API:
Uninstall-GitHubApp
to support multiple uninstallation modes (by target, by object, by installation ID, by app slug), improved parameter sets, and added context and authentication checks for safer operation.Documentation and Examples:
examples/Apps/UninstallingApps.ps1
showing various uninstallation scenarios for both app and enterprise contexts.Testing and Reliability:
Other Improvements:
Disconnect-GitHubAccount
.GitHubContext.Types.ps1xml
for better handling of missing token expiration..github/PSModule.yml
to enable and skip specific test and build steps as appropriate.Type of change
Checklist