Skip to content

Commit 3198789

Browse files
committed
👷 [ci] Improve git-cliff installation in publish workflow
- Replace fixed-exe lookup with a recursive search (Get-ChildItem -Recurse) so git-cliff.exe can be found in nested archive directories - Emit directory listing on failure and throw a clear error when exe is missing - Use the exe's parent folder (binPath) when prepending to PATH and persist the updated PATH to GITHUB_ENV; log the discovered exe path and verify --version 🧹 [chore] Tidy Invoke-MarkdownLinkCheck.ps1 and ensure provided paths are filtered - Add a blank line after the EXAMPLE block for readability - Normalize/respect provided Paths and filter out node_modules and the script file itself to avoid self-checks and irrelevant files Signed-off-by: Nick2bad4u <20943337+Nick2bad4u@users.noreply.github.com>
1 parent d1b4bd2 commit 3198789

2 files changed

Lines changed: 17 additions & 3 deletions

File tree

.github/workflows/publish.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,13 +253,20 @@ jobs:
253253
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipPath
254254
Expand-Archive -Path $zipPath -DestinationPath $extractPath -Force
255255
256-
$exePath = Join-Path $extractPath "git-cliff.exe"
257-
if (-not (Test-Path $exePath)) {
256+
# The exe might be in the root or in a subdirectory
257+
$exePath = Get-ChildItem -Path $extractPath -Filter "git-cliff.exe" -Recurse | Select-Object -First 1 -ExpandProperty FullName
258+
259+
if (-not $exePath -or -not (Test-Path $exePath)) {
260+
Write-Host "Directory structure:"
261+
Get-ChildItem -Path $extractPath -Recurse | ForEach-Object { Write-Host $_.FullName }
258262
throw "git-cliff.exe not found after extraction"
259263
}
260264
265+
$binPath = Split-Path $exePath -Parent
266+
Write-Host "Found git-cliff.exe at: $exePath"
267+
261268
# Add to PATH for this session
262-
$env:PATH = "$extractPath;$env:PATH"
269+
$env:PATH = "$binPath;$env:PATH"
263270
"PATH=$env:PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
264271
265272
Write-Host "git-cliff installed successfully"

scripts/Invoke-MarkdownLinkCheck.ps1

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
.EXAMPLE
2020
pwsh -NoProfile -File ./scripts/Invoke-MarkdownLinkCheck.ps1 -Paths docs/README.md
2121
#>
22+
2223
[CmdletBinding()]
2324
param(
2425
[Parameter()]
@@ -78,6 +79,12 @@ else {
7879
$Paths = $Paths | ForEach-Object { Resolve-ScanPath -Path $_ }
7980
}
8081

82+
# Filter out node_modules and this script itself
83+
$scriptFile = $MyInvocation.MyCommand.Path
84+
$Paths = $Paths | Where-Object {
85+
$_ -notmatch '\\node_modules\\' -and $_ -ne $scriptFile
86+
}
87+
8188
if (-not $Paths) {
8289
Write-Host 'No markdown files found.'
8390
return

0 commit comments

Comments
 (0)