Skip to content

Commit 8c7bd2c

Browse files
🪲 [Fix]: Fix an issue with generating docs (#56)
## Description - Fix an issue with generating docs. ## Type of change <!-- Use the check-boxes [x] on the options that are relevant. --> - [ ] 📖 [Docs] - [x] 🪲 [Fix] - [ ] 🩹 [Patch] - [ ] ⚠️ [Security fix] - [ ] 🚀 [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 03b5889 commit 8c7bd2c

File tree

2 files changed

+12
-37
lines changed

2 files changed

+12
-37
lines changed

.github/workflows/CI.yml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ jobs:
476476
uses: actions/download-artifact@v4
477477
with:
478478
name: docs
479-
path: ${{ inputs.DocsOutputPath }}
479+
path: '${{ inputs.SiteOutputPath }}/docs/Functions'
480480

481481
- name: Debug
482482
uses: PSModule/Debug@v0
@@ -495,20 +495,11 @@ jobs:
495495
uses: PSModule/GitHub-Script@v1
496496
with:
497497
Script: |
498-
$ModuleName = '${{ inputs.Name }}'
498+
$moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}'
499+
$ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}'
500+
$SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}'
499501
500-
if (-not $ModuleName) {
501-
$ModuleName = $env:GITHUB_REPOSITORY -replace '.+/'
502-
}
503-
Write-Verbose "Module name: $ModuleName"
504-
505-
$ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}'
506-
$DocsOutputPath = Join-Path (Get-Location) -ChildPath "${{ inputs.DocsOutputPath }}/$ModuleName"
507-
$SiteOutputPath = Join-Path (Get-Location) -ChildPath '${{ inputs.SiteOutputPath }}'
508-
509-
$functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions'
510-
$functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force
511-
Get-ChildItem -Path $DocsOutputPath -Recurse -Force -Include '*.md' | Copy-Item -Destination $functionDocsFolder -Recurse -Force
502+
$functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item
512503
Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
513504
$fileName = $_.Name
514505
$hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash

.github/workflows/workflow.yml

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -502,17 +502,10 @@ jobs:
502502
uses: actions/download-artifact@v4
503503
with:
504504
name: docs
505-
path: ${{ inputs.DocsOutputPath }}
505+
path: '${{ inputs.SiteOutputPath }}/docs/Functions'
506506

507-
- name: Debug File system
508-
shell: pwsh
509-
run: |
510-
Get-ChildItem -Path $env:GITHUB_WORKSPACE -Recurse | Select-Object -ExpandProperty FullName | Sort-Object
511-
512-
- name: Debug Env vars
513-
shell: pwsh
514-
run: |
515-
Get-ChildItem env: | Format-Table
507+
- name: Debug
508+
uses: PSModule/Debug@v0
516509

517510
- uses: actions/configure-pages@v5
518511

@@ -528,20 +521,11 @@ jobs:
528521
uses: PSModule/GitHub-Script@v1
529522
with:
530523
Script: |
531-
$ModuleName = '${{ inputs.Name }}'
532-
533-
if (-not $ModuleName) {
534-
$ModuleName = $env:GITHUB_REPOSITORY -replace '.+/'
535-
}
536-
Write-Verbose "Module name: $ModuleName"
537-
538-
$ModuleSourcePath = Join-Path (Get-Location) -ChildPath '${{ inputs.Path }}'
539-
$DocsOutputPath = Join-Path (Get-Location) -ChildPath "${{ inputs.DocsOutputPath }}/$ModuleName"
540-
$SiteOutputPath = Join-Path (Get-Location) -ChildPath '${{ inputs.SiteOutputPath }}'
524+
$moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}'
525+
$ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}'
526+
$SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}'
541527
542-
$functionDocsFolderPath = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions'
543-
$functionDocsFolder = New-Item -Path $functionDocsFolderPath -ItemType Directory -Force
544-
Copy-Item -Path $DocsOutputPath -Destination $functionDocsFolder -Recurse -Force
528+
$functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item
545529
Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
546530
$fileName = $_.Name
547531
$hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash

0 commit comments

Comments
 (0)