Skip to content

Conversation

MariusStorhaug
Copy link
Member

@MariusStorhaug MariusStorhaug commented May 17, 2025

This pull request introduces updates to GitHub repository management functionality, including new features, enhanced parameter handling, and additional examples. The changes primarily focus on refining repository creation, updating workflows, and adding a new Set-GitHubRepository function.

Enhancements to Repository Management:

  • New Set-GitHubRepository Functionality: Introduced a new function to create or update repositories based on their existence, with comprehensive parameter support for repository settings such as visibility, merge options, and security features (src/functions/public/Repositories/Set-GitHubRepository.ps1).

  • Refined Parameter Sets in New-GitHubRepository: Updated parameter sets for New-GitHubRepository to provide more descriptive names and improve clarity for creating repositories in different contexts (e.g., for authenticated users, organizations, or from templates) (src/functions/public/Repositories/New-GitHubRepository.ps1). [1] [2] [3] [4] [5]

  • Removed Redundant Parameters in Update-GitHubRepository: Eliminated the Declare parameter and associated logic to simplify the function and streamline its usage (src/functions/public/Repositories/Update-GitHubRepository.ps1). [1] [2]

Workflow and Testing Adjustments:

  • Skipped Tests and Documentation Builds: Updated .github/PSModule.yml to skip certain test and build steps, such as SourceCode, PSModule, and Docs, to optimize the CI/CD workflow. Additionally, set CodeCoverage to skip while maintaining a target percentage (.github/PSModule.yml).

Examples and Usability Improvements:

  • New Examples for Repository Functions: Added examples demonstrating the usage of New-GitHubRepository, Update-GitHubRepository, and Set-GitHubRepository with real-world scenarios, including creating repositories with specific configurations and comparing repository states (examples/Repositories.ps1, examples/Repositories/Set-GitHubRepository.ps1). [1] [2]

…epository object directly for improved data handling
…new GitHubRepository object for improved type handling
…operty for improved clarity and conciseness; standardize visibility options in New-GitHubRepository to match casing conventions.
…ting user repositories; standardize parameter naming to improve clarity and consistency.
…sitoryListByOwner for consistency in parameter naming.
…ser.Login if not specified, enhancing parameter handling.
…serName instead of Context.User.Login for improved accuracy in user context handling.
…bRepositoryListByOwner for enhanced filtering options; update Owner assignment in Get-GitHubRepository to use Context.UserName as fallback.
…case for consistent handling in Get-GitHubRepositoryListByOwner; update repository iteration to use foreach for clarity.
…d Get-GitHubRepositoryListByOwner to use Write-Output for improved clarity in data flow.
…d Get-GitHubRepositoryListByOwner to use Write-Output for improved clarity in data flow.
…t for improved logging clarity and consistency in output formatting.
…y to use Format-Table for improved readability; ensure output is returned from Get-GitHubMyRepositories and Get-GitHubRepositoryByName.
… Get-GitHubRepositoryListByOwner, and Get-GitHubRepository to return objects directly instead of using Write-Output.
…oryListByOwner to use Write-Debug for improved logging and clarity in object creation.
…ByName and Get-GitHubRepositoryListByOwner for cleaner output.
…ory constructor for proper object initialization.
… in GitHubRepository for proper object initialization.
…per object initialization and enhance clarity in repository handling.
…pository for clarity and to prevent unnecessary processing.
…sitory for proper object initialization and clarity.
…ry to enhance clarity and prevent unnecessary processing.
…e assignments in GitHubRepository for proper object initialization and clarity.
…ryPermissions and uncomment Permissions assignment in GitHubRepository for clarity and proper initialization.
… properties, ensuring consistent repository creation behavior
… calls in repository tests for cleaner output
…t-GitHubRepository for improved logging consistency; update repository tests to use -Verbose flag.
…tionally include it for non-fork repositories
- Created a template test file for structuring Pester tests.
- Implemented tests for GitHub Teams API, including team creation, retrieval, updating, and deletion.
- Developed tests for GitHub Users API, covering user retrieval and updates.
- Added extensive tests for GitHub Variables API, including variable creation, updates, retrieval, and deletion across different scopes (organization, repository, environment).
- Ensured proper authentication handling for GitHub Apps and user accounts.
- Included logging for better visibility during test execution.
- Suppressed specific Pester warnings to maintain code clarity and focus on test functionality.
…mprove clarity and remove redundant parameters
@MariusStorhaug MariusStorhaug marked this pull request as ready for review May 30, 2025 21:34
@Copilot Copilot AI review requested due to automatic review settings May 30, 2025 21:34
@MariusStorhaug MariusStorhaug requested a review from a team as a code owner May 30, 2025 21:34
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 PR adds a new Set-GitHubRepository cmdlet to unify create/update logic, refines parameter sets for repository functions, and enhances CI skips and examples.

  • Introduce Set-GitHubRepository for idempotent create-or-update workflows
  • Rename and streamline parameter sets in New-GitHubRepository and remove redundant flags in Update-GitHubRepository
  • Add extensive examples and test coverage for the new Set-GitHubRepository

Reviewed Changes

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

Show a summary per file
File Description
tests/Secrets.Tests.ps1 Temporarily enabled -Debug switch in secret tests
tests/Repositories.Tests.ps1 Expanded repository tests; added Set-GitHubRepository cases
src/functions/public/Repositories/Set-GitHubRepository.ps1 New cmdlet to create or update repositories
src/functions/public/Repositories/New-GitHubRepository.ps1 Renamed parameter sets and updated verbose/debug output
src/functions/public/Repositories/Update-GitHubRepository.ps1 Removed obsolete Declare flag and enhanced debug logging
Comments suppressed due to low confidence (1)

tests/Repositories.Tests.ps1:176

  • The AllowAutoMerge property is commented out and not being asserted; add or restore a test to cover this behavior.
# $repo.AllowAutoMerge | Should -Be $true

@MariusStorhaug MariusStorhaug changed the title Add a Set-GitHubRepository function 🩹[Patch]: Add a Set-GitHubRepository function May 30, 2025
@MariusStorhaug MariusStorhaug merged commit 65d7562 into main May 30, 2025
10 checks passed
@MariusStorhaug MariusStorhaug deleted the codex/create-set-githubrepository-function branch May 30, 2025 21:39
@github-actions
Copy link
Contributor

Module GitHub - 0.28.2 published to the PowerShell Gallery.

@github-actions
Copy link
Contributor

GitHub release for GitHub v0.28.2 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]: Add a function to Set-GitHubRepository for idempotent configuration

1 participant