-
Notifications
You must be signed in to change notification settings - Fork 4
🩹 [Patch]: Add Fine-Grained Permissions Data for GitHub PowerShell Module #501
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
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
… for repositories, organizations, users, and enterprises.
- Created Users.Tests.ps1 to test GitHub user-related functionalities including user retrieval and updates. - Created Variables.Tests.ps1 to test GitHub variable management across different scopes (organization, repository, environment). - Created Permissions.Tests.ps1 to validate permission definitions and GitHubPermission class properties. - Implemented logging and context management for better test output and organization. - Added necessary suppression attributes for Pester compatibility and long lines.
…ext and improve permission validation
…use correct permissions data
…ted permission string
…ions configuration
…readability and maintainability
…in GitHub.ps1 and tests
… consistency and clarity
@copilot Add argument completers for Get-GitHubPermissionDefinition, for the parameters 'Scope', 'Name' and 'Type'. |
Co-authored-by: MariusStorhaug <17722253+MariusStorhaug@users.noreply.github.com>
Added argument completers for all three parameters of Get-GitHubPermissionDefinition:
The completers follow the established patterns in the codebase and provide tab completion support for better user experience. Commit: 40bc1e3 |
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 implements a comprehensive fine-grained permissions data infrastructure for the GitHub PowerShell module, enabling detection of GitHub App installations that may be missing newly added permissions.
- Adds a new
GitHubPermissionDefinition
class to represent GitHub permissions with properties like Name, DisplayName, Description, URL, Options, Type, and Scope - Introduces 55 fine-grained permission definitions covering Repository (29), Organization (13), User (13), and Enterprise (6) scopes
- Implements
Get-GitHubPermissionDefinition
function with filtering capabilities and argument completers for improved user experience
Reviewed Changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
File | Description |
---|---|
tests/Permissions.Tests.ps1 | Comprehensive test suite for permission validation and the new function |
src/variables/private/GitHub.ps1 | Adds 55 fine-grained permission definitions to the module's data store |
src/functions/public/Permission/completers.ps1 | Implements argument completers for Name, Type, and Scope parameters |
src/functions/public/Permission/Get-GitHubPermissionDefinition.ps1 | New public function to query permission definitions with filtering |
src/formats/GitHubPermission.Format.ps1xml | Formatting configuration for displaying permissions in table format |
src/classes/public/GitHubPermissionDefinition.ps1 | Class definition for representing GitHub permission data |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
- Introduced Teams.Tests.ps1 to validate team creation, retrieval, updating, and deletion functionalities. - Added Users.Tests.ps1 to test user-related operations including user updates and email management. - Created Variables.Tests.ps1 to ensure proper handling of GitHub variables across different scopes (organization, repository, environment). - Enhanced Permissions.Tests.ps1 to improve structure and readability, consolidating permission checks for GitHub Apps.
…missionDefinition output
…inition formatting
- Created TEMPLATE.ps1 for Pester tests with a structure for authentication cases. - 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. - Implemented Variables.Tests.ps1 to test GitHub variable management across different scopes (organization, repository, environment).
Module GitHub - 0.36.10 published to the PowerShell Gallery. |
GitHub release for GitHub v0.36.10 has been created. |
This PR implements a comprehensive fine-grained permissions data infrastructure for the GitHub PowerShell module, enabling detection of GitHub App installations that may be missing newly added permissions.
What's New
GitHubPermission Class
Added a new public
GitHubPermission
class with the following properties:contents
,issues
)read
,write
,admin
)Fine-grained
,Classic
)Repository
,Organization
,User
,Enterprise
)Comprehensive Permissions Database
Added 90 fine-grained permissions covering all major GitHub permission categories:
Get-GitHubPermissionDefinition Function
New public function to query the permissions database with advanced filtering:
Argument Completers
Added argument completers for
Get-GitHubPermissionDefinition
parameters to improve user experience:Use Cases
This infrastructure enables several key scenarios:
Implementation Details
FilePaths
property rather than as named permissions)Example Usage
This provides the foundation for building automated permission management tools and ensuring GitHub App installations remain up-to-date with the latest permission requirements.