-
Notifications
You must be signed in to change notification settings - Fork 5
🚀[Feature]: Permission infrastructure + Track GitHub App Installation status #513
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
…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>
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.
@copilot Fix please.
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.
@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.
… in GitHubApp and GitHubAppContext classes
…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
…tallation details instead of the entire list
…ariable for GitHubPermissionDefinition list
…s for improved handling of permissions from PSCustomObject
…casing across GitHubPermission class and related contexts
…y removing unnecessary variable assignment
…t methods for improved clarity and performance
…n array and enhance import functionality
…ss and improve readability
… for permissions and improve test assertions for clarity
…nd ensure valid permission types
… ensure they always run
…ns output and streamline permission validation logic
…Permissions instead of PSObject.Properties
- 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.
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 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
toGitHubPermission[]
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.
… GitHubAppInstallation format
…on for consistent permission retrieval
Module GitHub - 0.38.0 published to the PowerShell Gallery. |
GitHub release for GitHub v0.38.0 has been created. |
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:
[pscustomobject]
for permissions inGitHubApp
,GitHubAppInstallation
,GitHubAppContext
, andGitHubAppInstallationContext
with[GitHubPermission[]]
, ensuring permissions are strongly typed and consistently handled.GitHubPermissionDefinition
class with theGitHubPermission
in theGitHubPermission.ps1
file.Installation Status and Comparison Logic:
Status
property toGitHubAppInstallation
and implements logic to compare installation permissions with app permissions, setting status as'Ok'
or'Outdated'
accordingly.Get-GitHubAppInstallationForAuthenticatedApp
to pass the authenticated app object to each installation for accurate status calculation.Formatting and Output Enhancements:
GitHubAppInstallation
format XML to display the newStatus
property in both table and list views, using symbols and colors when supported for better clarity.GitHubPermission
, improving how permissions are displayed in the console, including hyperlinks for permission names when supported.Configuration and Miscellaneous:
Context
parameter mandatory and positional inSwitch-GitHubContext
for improved usability.