-
Notifications
You must be signed in to change notification settings - Fork 5
🚀 [Feature]: Add functions to manage team permissions on repositories #410
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
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
Adds PowerShell functions and argument completers to manage team permissions on GitHub repositories.
- Introduces
Get-
,Set-
, andRemove-GitHubRepositoryPermission
functions with context validation andShouldProcess
safety. - Adds argument completers for the
Team
parameter (dynamic slugs) andPermission
parameter (predefined levels). - Improves user experience by filtering valid teams and permission values during tab completion.
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
src/functions/public/Teams/completers.ps1 | Registers Team completer for all exported functions using organization context |
src/functions/public/Repositories/Permissions/completers.ps1 | Adds Permission completer for Set-GitHubRepositoryPermission |
src/functions/public/Repositories/Permissions/Set-GitHubRepositoryPermission.ps1 | Implements setting/updating team permissions, delegates removal when None |
src/functions/public/Repositories/Permissions/Remove-GitHubRepositoryPermission.ps1 | Implements removal of a team’s repository access with ShouldProcess |
src/functions/public/Repositories/Permissions/Get-GitHubRepositoryPermission.ps1 | Implements retrieval of a team’s repository permission level |
@BenjaminEngeset: Prerelease ready in 1 hour approx. |
Module GitHub - 0.31.1-RepoPermissions001 published to the PowerShell Gallery. |
GitHub release for GitHub v0.31.1-RepoPermissions001 has been created. |
…ions by team and repository, and enhance documentation with examples.
- Created TEMPLATE.ps1 for structuring tests with Pester. - Implemented Users.Tests.ps1 to test user-related GitHub functionalities, including user retrieval and updates. - Developed Variables.Tests.ps1 to manage GitHub variables across different scopes (organization, repository, environment). - Included logging and context management for better test output and organization. - Added support for handling authentication cases and GitHub App connections.
…ls and improve parameter handling
# Get a list of teams and their permissions for a specific GitHub repository
Get-GithubTeam -Owner 'OrgName' -Repository 'RepoName'
# > Return Teams with permission to repo (including a permission property)
# Private function: Get-GitHubTeamListByRepo
# Get a list of repositories and their permissions for a specific GitHub team
Get-GithubRepository -Owner 'OrgName' -Team 'TeamSlug'
# > Return repo with permission to repo (including a permission property)
# Private function: Get-GitHubRepositoryListByTeam
# Get permission for a specific GitHub repository for a specific team
Get-GithubRepository -Owner 'OrgName' -Repository 'RepoName' -Team 'TeamSlug'
# > Return repo with permission to repo (including a permission property)
Get-GithubRepositoryPermission -Owner 'OrgName' -Repository 'RepoName' -Team 'TeamSlug'
# > Return Permission |
… deprecated GitHubRepositoryPermissions class
…ional owner types and permissions, refactor team permission retrieval functions, and enhance API integration for team management.
…yml, enhancing GitHubOwner and GitHubTeam classes, and implementing new functions for team repository permissions.
…nstructor for GitHubTeam objects, improving code clarity and efficiency.
…ies, update constructor to accept Organization, and adjust related functions for consistency in team management.
…tions to include Organization parameter for improved context handling.
b505df0
to
ff19031
Compare
… for improved output visibility during team retrieval.
…to suppress confirmation prompts
…n function and update tests to remove confirmation prompts
…nd update tests to include -Debug, -Verbose, and -Confirm:$false parameters
…mission and update permission retrieval logic
…on tests and add validation for non-existent teams
… tests for consistency
…mission tests for accuracy
…moval of repository permissions for teams
bd2bad3
to
2b818c5
Compare
…rity and remove unnecessary confirmations
…al of permissions for teams
…ons and add debug logging
…pository permissions and improve debug logging
…rocessing and improve debug logging
…ebug output formatting
…nd improve debug logging
- Created TEMPLATE.ps1 for structuring test cases with Pester. - Implemented Users.Tests.ps1 to test user-related GitHub functionalities, including user retrieval and updates. - Developed Variables.Tests.ps1 to validate GitHub variable management, including creation, updating, and removal of variables for users, organizations, and repositories. - Added logging and context management for better test output and organization.
…ositoryByNameAndTeam
Module GitHub - 0.32.0 published to the PowerShell Gallery. |
GitHub release for GitHub v0.32.0 has been created. |
Description
This pull request introduces significant changes to the PowerShell module for interacting with GitHub, focusing on improving repository and team permission management. The most notable updates include refactoring permission-related classes and methods, adding new functions for team-repository interactions, and removing deprecated or redundant functionality.
Permission Management Updates:
GitHubRepositoryPermissions
class toGitHubRepositoryPermission
, simplifying its structure and adding a static methodGetPermissionString
to convert permission objects to strings. This change also updated permission-related properties and methods across the module.Permissions
property inGitHubRepository
with a simplifiedPermission
property and updated GraphQL queries accordingly.New Team-Repository Functions:
Get-GitHubRepositoryByNameAndTeam
to retrieve the permission level assigned to a specific team for a repository.Get-GitHubRepositoryListByTeam
to list all repositories accessible by a team within an organization.Team Object Enhancements:
GitHubTeam
class to include aPermission
property for team-level repository permissions and removed unused properties likeCombinedSlug
,ParentTeam
, andChildTeams
.Deprecated Functionality Removal:
Get-GitHubRESTTeam
andGet-GitHubRESTTeamByName
functions, consolidating their functionality into other areas of the module.Type of change
Checklist