Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Sep 12, 2025

This pull request introduces several improvements to how GitHub App permissions are represented, compared, and displayed throughout the codebase. The main focus is on replacing the use of generic objects for permissions with a strongly-typed GitHubPermission class, adding installation status comparison logic, and enhancing output formatting for better user experience.

Key changes include:

Permission Model Refactor:

  • Replaces all uses of [pscustomobject] for permissions in GitHubApp, GitHubAppInstallation, GitHubAppContext, and GitHubAppInstallationContext with [GitHubPermission[]], ensuring permissions are strongly typed and consistently handled.
  • Colocate GitHubPermissionDefinition class with the GitHubPermission in the GitHubPermission.ps1 file.

Installation Status and Comparison Logic:

  • Adds a Status property to GitHubAppInstallation and implements logic to compare installation permissions with app permissions, setting status as 'Ok' or 'Outdated' accordingly.
  • Updates Get-GitHubAppInstallationForAuthenticatedApp to pass the authenticated app object to each installation for accurate status calculation.

Formatting and Output Enhancements:

  • Updates the GitHubAppInstallation format XML to display the new Status property in both table and list views, using symbols and colors when supported for better clarity.
  • Adds a new format file for GitHubPermission, improving how permissions are displayed in the console, including hyperlinks for permission names when supported.

Configuration and Miscellaneous:

  • Makes the Context parameter mandatory and positional in Switch-GitHubContext for improved usability.

Copilot AI and others added 2 commits September 12, 2025 13:55
…ions and events

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
…te tests

Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
@Copilot Copilot AI changed the title [WIP] 🩹 [Patch]: Track if Github App Installations are updated, based on the permissions and events that an app requests 🩹 [Patch]: Track GitHub App Installation status by comparing permissions and events with app configuration Sep 12, 2025
Copilot finished work on behalf of MariusStorhaug September 12, 2025 14:00
@Copilot Copilot AI requested a review from MariusStorhaug September 12, 2025 14:00
Copy link
Member

@MariusStorhaug MariusStorhaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot Fix please.

Copy link
Member

@MariusStorhaug MariusStorhaug left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot please fix

…pdate authentication handling in API version retrieval
- Created TEMPLATE.ps1 for Pester testing framework setup.
- Implemented Teams.Tests.ps1 to test GitHub Teams API functionalities including team creation, retrieval, updating, and deletion.
- Added Users.Tests.ps1 to validate user-related API calls, including user retrieval and updates.
- Developed Variables.Tests.ps1 to manage GitHub repository and organization variables, including creation, updating, and removal of variables.
…permissions and update permissions assignment in Set-GitHubContext function
…tallation classes to use NewFullCatalog for comprehensive permission management
…ext to use NewFullCatalog for improved permission management
…s for improved handling of permissions from PSCustomObject
…casing across GitHubPermission class and related contexts
…t methods for improved clarity and performance
… for permissions and improve test assertions for clarity
…ns output and streamline permission validation logic
@MariusStorhaug MariusStorhaug marked this pull request as ready for review September 15, 2025 15:20
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner September 15, 2025 15:20
@Copilot Copilot AI review requested due to automatic review settings September 15, 2025 15:20
- Created TEMPLATE.ps1 for Pester testing framework setup.
- 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 repository and organization variable management, including setting, updating, and removing variables.
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 pull request enhances GitHub App permission handling by introducing strongly-typed permission classes and installation status tracking. The main changes replace generic objects with structured GitHubPermission classes and add status comparison logic to track whether installations are up-to-date with their app configurations.

Key changes:

  • Refactored permission model from PSCustomObject to GitHubPermission[] throughout the codebase
  • Added installation status tracking that compares app and installation permissions/events
  • Enhanced formatting and output with new format files and improved console display

Reviewed Changes

Copilot reviewed 19 out of 19 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/classes/public/GitHubPermission.ps1 Defines new GitHubPermissionDefinition and GitHubPermission classes with static permission catalog
src/classes/public/App/GitHubApp.ps1 Updates GitHubApp to use GitHubPermission[] instead of PSCustomObject
src/classes/public/App/GitHubAppInstallation.ps1 Adds Status property and comparison logic for installation status tracking
src/formats/GitHubPermission.Format.ps1xml New format file for displaying permissions with hyperlinks
src/formats/GitHubAppInstallation.Format.ps1xml Updates to display Status column with colored symbols
tests/Permissions.Tests.ps1 Updates tests to use new permission classes and validation logic
tests/Apps.Tests.ps1 Updates app-related tests for new permission structure

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

@MariusStorhaug MariusStorhaug changed the title 🩹 [Patch]: Track GitHub App Installation status by comparing permissions and events with app configuration 🚀[Feature]: Permission infrastructure + Track GitHub App Installation status Sep 15, 2025
@MariusStorhaug MariusStorhaug merged commit 0294114 into main Sep 15, 2025
18 of 26 checks passed
@MariusStorhaug MariusStorhaug deleted the copilot/fix-510 branch September 15, 2025 21:32
Copy link
Contributor

Module GitHub - 0.38.0 published to the PowerShell Gallery.

Copy link
Contributor

GitHub release for GitHub v0.38.0 has been created.

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

Successfully merging this pull request may close these issues.

🩹 [Patch]: Track if Github App Installations are updated, based on the permissions and events that an app requests
2 participants