diff --git a/.github/scripts/Test-KnowledgeIndex.ps1 b/.github/scripts/Test-KnowledgeIndex.ps1 index 224b010..76896af 100644 --- a/.github/scripts/Test-KnowledgeIndex.ps1 +++ b/.github/scripts/Test-KnowledgeIndex.ps1 @@ -27,6 +27,10 @@ param( Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' +# Normalise to an absolute path so Substring-based relative-path derivation +# below matches the absolute FullName the generator emits (CI passes -Root .). +$Root = (Resolve-Path -LiteralPath $Root).Path + $generator = Join-Path $Root 'tools/Build-KnowledgeIndex.ps1' if (-not (Test-Path $generator)) { throw "Generator not found: $generator" } diff --git a/tools/Build-KnowledgeIndex.ps1 b/tools/Build-KnowledgeIndex.ps1 index 09758b9..5835e5d 100644 --- a/tools/Build-KnowledgeIndex.ps1 +++ b/tools/Build-KnowledgeIndex.ps1 @@ -79,6 +79,10 @@ if (-not $BCQualityRoot) { if (-not (Test-Path $BCQualityRoot)) { throw "BCQuality root not found: $BCQualityRoot" } +# Normalise to an absolute path: Get-ChildItem.FullName below is always +# absolute, so Get-RelativePath's Substring needs an absolute root to strip. +# A relative root (e.g. '.') would otherwise leave the full path intact. +$BCQualityRoot = (Resolve-Path -LiteralPath $BCQualityRoot).Path if (-not $IndexPath) { $IndexPath = Join-Path $BCQualityRoot 'knowledge-index.json' }