Skip to content

Commit 09ff31f

Browse files
🩹 [Docs]: Enhance Build-Docs workflow to dynamically locate mkdocs.yml file
1 parent 2a7a856 commit 09ff31f

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

‎.github/workflows/Build-Docs.yml

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,25 @@ jobs:
189189
190190
LogGroup 'Build docs - Create mkdocs.yml' {
191191
$rootPath = Split-Path -Path $ModuleSourcePath -Parent
192-
# This should be moved to an action so that we can use a default one, and not have to copy it from the repo.
193-
$mkdocsSourcePath = Join-Path -Path $rootPath -ChildPath 'mkdocs.yml'
192+
$possiblePaths = @(
193+
'.github/mkdocs.yml',
194+
'docs/mkdocs.yml',
195+
'mkdocs.yml'
196+
)
197+
198+
$mkdocsSourcePath = $null
199+
foreach ($path in $possiblePaths) {
200+
$candidatePath = Join-Path -Path $rootPath -ChildPath $path
201+
if (Test-Path -Path $candidatePath) {
202+
$mkdocsSourcePath = $candidatePath
203+
break
204+
}
205+
}
206+
207+
if (-not $mkdocsSourcePath) {
208+
throw "Mkdocs source file not found in any of the expected locations: $($possiblePaths -join ', ')"
209+
}
210+
194211
$mkdocsTargetPath = Join-Path -Path $SiteOutputPath -ChildPath 'mkdocs.yml'
195212
196213
Write-Host "Mkdocs Source Path: $mkdocsSourcePath"

0 commit comments

Comments
 (0)