-
Notifications
You must be signed in to change notification settings - Fork 5
🪲 [Fix]: Get-GitHubContext
no longer fails when there are no contexts to return
#402
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
This PR addresses issues related to the GitHub context retrieval by ensuring that Get-GitHubContext handles the case with 0 available contexts without failing, and it updates the PSModule YAML configuration to skip several build, test, and coverage steps.
- Adds a new test case to verify that Get-GitHubContext does not throw and returns an empty value when no contexts exist.
- Updates the .github/PSModule.yml file to skip unnecessary build targets and tests.
Reviewed Changes
Copilot reviewed 12 out of 12 changed files in this pull request and generated no comments.
File | Description |
---|---|
tests/GitHub.Tests.ps1 | Added a test to ensure Get-GitHubContext handles 0 contexts gracefully. |
.github/PSModule.yml | Updated configuration to skip specific build and test steps. |
…ing instead of throw for missing default context
…lls in anonymous function tests
- 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, including email management. - Added extensive tests for GitHub Variables API, focusing on variable creation, updates, retrieval, and deletion across different scopes (user, organization, repository, environment). - Ensured all tests log context and results for better traceability in CI/CD environments. - Included necessary suppressions for Pester warnings to maintain clean test output.
Get-GitHubContext
should not fail when there are no contexts to return
Get-GitHubContext
should not fail when there are no contexts to returnGet-GitHubContext
no longer fails when there are no contexts to return
Module GitHub - 0.29.4 published to the PowerShell Gallery. |
GitHub release for GitHub v0.29.4 has been created. |
Description
This pull request includes improvements to
Get-GitHubContext
, replacing a thrown exception with a warning, causing it not error out if there are no contexts to return.Error Handling Improvements:
Get-GitHubContext
does not throw an exception when no contexts are available and returns an empty result.Type of change
Checklist