Skip to content

Commit 44ceccb

Browse files
🪲 [Fix]: Fix placement of docs after copy (#138)
## Description This pull request includes improvements to the `CI.yml` and `workflow.yml` reusable workflows. * Modified the `Copy-Item` command to include all files in the source directory by appending `/*` to the path. * Added a `try-catch` block around the `git add` and `git commit` commands to handle cases where there are no changes to commit, preventing errors. ## 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 175c6b8 commit 44ceccb

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

.github/workflows/CI.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -266,8 +266,13 @@ jobs:
266266
# Rename the gitignore file to .gitignore.bak
267267
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
268268
269-
git add .
270-
git commit -m 'Update documentation'
269+
try {
270+
# Add all changes to the repository
271+
git add .
272+
git commit -m 'Update documentation'
273+
} catch {
274+
Write-Host "No changes to commit"
275+
}
271276
272277
# Restore the gitignore file
273278
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
@@ -307,7 +312,7 @@ jobs:
307312
Version: ${{ inputs.Version }}
308313
Script: |
309314
New-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -ItemType Directory -Force
310-
Copy-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.DocsOutputPath }}" -Destination "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -Recurse -Force
315+
Copy-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.DocsOutputPath }}/*" -Destination "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -Recurse -Force
311316
$moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}'
312317
$ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}'
313318
$SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}'

.github/workflows/workflow.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,13 @@ jobs:
273273
# Rename the gitignore file to .gitignore.bak
274274
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
275275
276-
git add .
277-
git commit -m 'Update documentation'
276+
try {
277+
# Add all changes to the repository
278+
git add .
279+
git commit -m 'Update documentation'
280+
} catch {
281+
Write-Host "No changes to commit"
282+
}
278283
279284
# Restore the gitignore file
280285
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
@@ -314,20 +319,19 @@ jobs:
314319
Version: ${{ inputs.Version }}
315320
Script: |
316321
New-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -ItemType Directory -Force
317-
Copy-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.DocsOutputPath }}" -Destination "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -Recurse -Force
322+
Copy-Item -Path "$env:GITHUB_WORKSPACE/${{ inputs.DocsOutputPath }}/*" -Destination "$env:GITHUB_WORKSPACE/${{ inputs.SiteOutputPath }}/docs/Functions" -Recurse -Force
318323
$moduleName = [string]::IsNullOrEmpty('${{ inputs.Name }}') ? $env:GITHUB_REPOSITORY_NAME : '${{ inputs.Name }}'
319324
$ModuleSourcePath = Join-Path $PWD -ChildPath '${{ inputs.Path }}'
320325
$SiteOutputPath = Join-Path $PWD -ChildPath '${{ inputs.SiteOutputPath }}'
321326
322-
LogGroup "Get folderstructure" {
323-
Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object
327+
LogGroup "Get folder structure" {
328+
Get-ChildItem -Recurse | Select-Object -ExpandProperty FullName | Sort-Object | Format-List
324329
}
325330
326331
$functionDocsFolder = Join-Path -Path $SiteOutputPath -ChildPath 'docs/Functions' | Get-Item
327332
Get-ChildItem -Path $functionDocsFolder -Recurse -Force -Include '*.md' | ForEach-Object {
328333
$fileName = $_.Name
329-
$hash = (Get-FileHash -Path $_.FullName -Algorithm SHA256).Hash
330-
LogGroup " - [$fileName] - [$hash]" {
334+
LogGroup " - $fileName" {
331335
Show-FileContent -Path $_
332336
}
333337
}

0 commit comments

Comments
 (0)