Skip to content

Commit 58ad447

Browse files
πŸš€ [Feature]: Update required version of Context module to 7.0.2 (#306)
## Description This pull request updates the dependency on `Context` to `7.0.2` which no longer relies on `SecretStore` and `SecretManagement` PowerShell modules, but contains its own local vault logic. ### Module Version Updates: * Updated the required version of the `Context` module from `6.0.0` to `7.0.2` across multiple files, including `examples/Connecting.ps1`, `src/functions/private/Auth/Context/Remove-GitHubContext.ps1`, `src/functions/private/Auth/Context/Set-GitHubContext.ps1`, `src/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1`, `src/functions/private/Config/Initialize-GitHubConfig.ps1`, `src/functions/public/Auth/Context/Get-GitHubContext.ps1`, `src/functions/public/Config/Remove-GitHubConfig.ps1`, and `src/functions/public/Config/Set-GitHubConfig.ps1`. ### Code Cleanup: * Removed references to `Microsoft.PowerShell.SecretManagement` from `examples/Connecting.ps1`, `tests/GitHub.Tests.ps1`, and `tools/utilities/Local-Testing.ps1`. * Cleaned up unused or redundant code in `tests/GitHub.Tests.ps1` by removing `Get-SecretInfo` and `Get-SecretVault` commands. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] πŸ“– [Docs] - [ ] πŸͺ² [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [x] πŸš€ [Feature] - [ ] 🌟 [Breaking change] ## Checklist <!-- Use the check-boxes [x] on the options that are relevant. --> - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas
1 parent ef6c4aa commit 58ad447

File tree

11 files changed

+16
-38
lines changed

11 files changed

+16
-38
lines changed

β€ŽREADME.md

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -204,21 +204,10 @@ Get-Command -Module GitHub
204204

205205
- [Generic HTTP Status Codes (MDN)](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status)
206206

207-
### Inspiration Behind the Project
207+
### Alternative GitHub PowerShell Modules
208208

209209
- [Microsoft's PowerShellForGitHub](https://github.com/microsoft/PowerShellForGitHub)
210210
- [PSGitHub by pcgeek86](https://github.com/pcgeek86/PSGitHub)
211-
- [PSSodium by TylerLeonhardt](https://github.com/TylerLeonhardt/PSSodium)
212-
- [libsodium NuGet Package](https://www.nuget.org/packages/Sodium.Core/)
213211
- [GitHubActions by ebekker](https://github.com/ebekker/pwsh-github-action-tools)
214212
- [powershell-devops by smokedlinq](https://github.com/smokedlinq/powershell-devops)
215213
- [GitHubActionsToolkit by hugoalh-studio](https://github.com/hugoalh-studio/ghactions-toolkit-powershell)
216-
217-
### Authentication and Login
218-
219-
- [PowerShell for GitHub on GitHub Marketplace](https://github.com/apps/powershell-for-github)
220-
- [Building a CLI with a GitHub App](https://docs.github.com/en/apps/creating-github-apps/writing-code-for-a-github-app/building-a-cli-with-a-github-app)
221-
222-
### Module Configuration and Environment
223-
224-
- [GH Environment for GitHub CLI](https://cli.github.com/manual/gh_help_environment)

β€Žexamples/Connecting.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
2-
#Requires -Modules @{ ModuleName = 'Microsoft.PowerShell.SecretManagement'; RequiredVersion = '1.1.2' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
32

43
###
54
### CONNECTING
@@ -49,9 +48,8 @@ Set-GitHubDefaultContext -Context 'msx.ghe.com/MariusStorhaug'
4948
Get-GitHubContext -Context 'github.com/MariusStorhaug' | Set-GitHubDefaultContext
5049

5150
# Abstraction layers on GitHubContexts
52-
Get-GitHubContext -Context 'msx.ghe.com/MariusStorhaug' # Only manages secrets prefixed with 'Context:PSModule.GitHub/'
53-
Get-Context -ID 'PSModule.GitHub/msx.ghe.com/MariusStorhaug' # Only manages secrets prefixed with 'Context:', handles conversion to/from JSON
54-
Get-Secret -Name 'Context:PSModule.GitHub/msx.ghe.com/MariusStorhaug' # Only manages secrets storage on the system
51+
Get-GitHubContext -Context 'msx.ghe.com/MariusStorhaug'
52+
Get-Context -ID 'PSModule.GitHub/msx.ghe.com/MariusStorhaug'
5553

5654
###
5755
### DISCONNECTING

β€Žsrc/functions/private/Auth/Context/Remove-GitHubContext.ps1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
22

33
filter Remove-GitHubContext {
44
<#
@@ -16,9 +16,9 @@ filter Remove-GitHubContext {
1616
Removes all contexts from the vault.
1717
1818
.EXAMPLE
19-
Remove-Context -ID 'MySecret'
19+
Remove-Context -ID 'MyContext'
2020
21-
Removes the context called 'MySecret' from the vault.
21+
Removes the context called 'MyContext' from the vault.
2222
#>
2323
[OutputType([void])]
2424
[CmdletBinding(SupportsShouldProcess)]
@@ -38,7 +38,7 @@ filter Remove-GitHubContext {
3838
process {
3939
$ID = "$($script:GitHub.Config.ID)/$Context"
4040

41-
if ($PSCmdlet.ShouldProcess('Remove-Secret', $context.Name)) {
41+
if ($PSCmdlet.ShouldProcess($context.Name, 'Remove context')) {
4242
Remove-Context -ID $ID
4343
}
4444
}

β€Žsrc/functions/private/Auth/Context/Set-GitHubContext.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
22

33
function Set-GitHubContext {
44
<#

β€Žsrc/functions/private/Auth/DeviceFlow/Update-GitHubUserAccessToken.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,4 +98,4 @@
9898
Write-Debug "[$stackPath] - End"
9999
}
100100
}
101-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
101+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }

β€Žsrc/functions/private/Config/Initialize-GitHubConfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
22

33
function Initialize-GitHubConfig {
44
<#

β€Žsrc/functions/public/Auth/Context/Get-GitHubContext.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
22

33
function Get-GitHubContext {
44
<#

β€Žsrc/functions/public/Config/Remove-GitHubConfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
22

33
function Remove-GitHubConfig {
44
<#

β€Žsrc/functions/public/Config/Set-GitHubConfig.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '6.0.0' }
1+
#Requires -Modules @{ ModuleName = 'Context'; RequiredVersion = '7.0.2' }
22

33
function Set-GitHubConfig {
44
<#

β€Žtests/GitHub.Tests.ps1

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
#Requires -Modules @{ ModuleName = 'Microsoft.PowerShell.SecretManagement'; RequiredVersion = '1.1.2' }
2-
#Requires -Modules @{ ModuleName = 'Pester'; RequiredVersion = '5.7.1' }
1+
#Requires -Modules @{ ModuleName = 'Pester'; RequiredVersion = '5.7.1' }
32

43
[Diagnostics.CodeAnalysis.SuppressMessageAttribute(
54
'PSUseDeclaredVarsMoreThanAssignments', '',
@@ -13,8 +12,6 @@
1312
param()
1413

1514
BeforeAll {
16-
Get-SecretInfo | Remove-Secret
17-
Get-SecretVault | Unregister-SecretVault
1815
Get-Module -ListAvailable -Name Context | Sort-Object -Property Version | Select-Object -Last 1 | Import-Module -Force
1916
}
2017

0 commit comments

Comments
Β (0)