Skip to content

Commit 74fee4f

Browse files
sharpninjaCopilot
andcommitted
Fix code review issues: remove hardcoded API key, update GH Actions, fix drive scan, graceful module-loader degradation
- C1: Remove hardcoded Bing API key from bing.ps1, require env var - C2: Replace deprecated set-output with GITHUB_OUTPUT in manual.yml - C3: Fix push URL to PS-Services org, update checkout to v4 - H1: Fix Snippetscode typo in _common.ps1 verbose output - H2: Replace recursive C:\ scan with targeted search in github.ps1 - H5: Graceful degradation when powershell-yaml unavailable - M4: Use Version.TryParse for SemVer pre-release strings - M6: Remove invalid -Scope from Uninstall-PSResource - M8: Fix oh-my-posh-windows Desktop branch to use 'powershell' - D2: Fix wq to wg winget alias in README - L2: Update all GitHub Actions to latest versions - L3: Add SnippetsModulesYaml to ReadmeTest.ps9 templates - Add full project code review document Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 21c521a commit 74fee4f

12 files changed

Lines changed: 467 additions & 28 deletions

.github/workflows/jekyll-gh-pages.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ jobs:
3030
runs-on: ubuntu-latest
3131
steps:
3232
- name: Checkout
33-
uses: actions/checkout@v3
33+
uses: actions/checkout@v4
3434
- name: Setup Pages
35-
uses: actions/configure-pages@v3
35+
uses: actions/configure-pages@v5
3636
# - name: Build with Jekyll
3737
# uses: actions/jekyll-build-pages@v1
3838
# with:
@@ -43,7 +43,7 @@ jobs:
4343
with:
4444
args: docs/docfx.json
4545
- name: Upload artifact
46-
uses: actions/upload-pages-artifact@v1
46+
uses: actions/upload-pages-artifact@v4
4747

4848
# Deployment job
4949
deploy:
@@ -55,4 +55,4 @@ jobs:
5555
steps:
5656
- name: Deploy to GitHub Pages
5757
id: deployment
58-
uses: actions/deploy-pages@v2
58+
uses: actions/deploy-pages@v4

.github/workflows/manual.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
runs-on: ubuntu-latest
1717
steps:
1818
- name: "Checkout source code"
19-
uses: "actions/checkout@v1"
19+
uses: "actions/checkout@v4"
2020
- name: Setup latest .NET SDKs
2121
uses: Elskom/setup-latest-dotnet@v1
2222
with:
@@ -35,12 +35,12 @@ jobs:
3535
echo "Error!" 1>&2
3636
exit 64
3737
fi
38-
echo "::set-output name=version::$version"
38+
echo "version=$version" >> "$GITHUB_OUTPUT"
3939
git config --global user.email "ninja@thesharp.ninja"
4040
git config --global user.name "GitHub on behalf of Sharp Ninja"
4141
git stage ./.version
4242
git commit -m 'Updated `.version`' --allow-empty --status
43-
git push --repo='https://sharpninja:${{ secrets.GITHUB_TOKEN }}@github.com/sharpninja/Snippets.git'
43+
git push --repo='https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/PS-Services/Snippets.git'
4444
4545
- uses: "marvinpinto/action-automatic-releases@latest"
4646
with:

Linux-ReadmeTest.ps9

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# $env:VerboseStartup = 'true'
22
$profileScript = Split-Path $PROFILE -Leaf
33

4+
$env:SnippetsModulesYaml = "$env:HOME/modules.yml"
5+
46
$exclusions=@()
57
# EXCLUSIONS-START
68
$exclusions += '*Windows*','repos*','choco*'

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ Write-Verbose 'PowerShell Ready.' -Verbose:$MasterVerbose
228228
### Windows
229229

230230
- `repos` Search all OS repos
231-
- `wq` winget
231+
- `wg` winget
232232
- `scp` scoop
233233
- `ch` chocolatey
234234

SnippetsManager.psm1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1306,7 +1306,7 @@ class PSGalleryManager : PackageManager {
13061306
'^uninstall|remove' {
13071307
if ($moduleName) {
13081308
if ($usePSResourceGet) {
1309-
Uninstall-PSResource -Name $moduleName -Scope CurrentUser -ErrorAction Stop
1309+
Uninstall-PSResource -Name $moduleName -ErrorAction Stop
13101310
}
13111311
else {
13121312
Uninstall-Module -Name $moduleName -Force -ErrorAction Stop

Windows-ReadmeTest.ps9

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# $env:VerboseStartup = 'true'
22
$profileScript = Split-Path $PROFILE -Leaf
33

4+
$env:SnippetsModulesYaml = "$env:USERPROFILE\modules.yml"
5+
46
$exclusions = @()
57
# EXCLUSIONS-START
68
$exclusions += '*Linux*'

_common.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ function Initialize-Snippets {
9696
}
9797
}
9898
finally {
99-
Write-Verbose "[$script] [$env:Snippetscode Initialized] -not `$env:SnippetsInitialized: $(-not $env:SnippetsInitialized)" -Verbose:$VerboseSwitch
99+
Write-Verbose "[$script] [$env:SnippetsInitialized] -not `$env:SnippetsInitialized: $(-not $env:SnippetsInitialized)" -Verbose:$VerboseSwitch
100100

101101
Pop-Location -Verbose:$VerboseSwitch
102102
$Verbose = $VerboseSwitch

bing.ps1

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,10 @@ try {
3030
$env:BingLocation = $env:Snippets
3131
if (-not $env:BingLocation.EndsWith("Snippets")) { $env:BingLocation = Join-Path $env:BingLocation -Child "Snippets" }
3232
Write-Verbose "[$script] `$env:BingLocation: $env:BingLocation" -Verbose:$Verbose
33-
$ApiKey = '3c7e251544ba414cbeacad9db55bdf6e'
34-
35-
$env:BingApiKey = $ApiKey
33+
if (-not $env:BingApiKey) {
34+
Write-Verbose "[$script] `$env:BingApiKey not set. Bing search will not work." -Verbose:$Verbose
35+
return "Set `$env:BingApiKey to use Bing search."
36+
}
3637
function Search-Bing {
3738
$query = [System.String]::Join(' ', $args);
3839
$csxPath = Join-Path $env:BingLocation -Child 'bing.csx' ;

0 commit comments

Comments
 (0)