Skip to content

Commit 449252d

Browse files
🩹 [CI]: Add checks before renaming .gitignore files in Build-Docs workflow
1 parent c83ee48 commit 449252d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

‎.github/workflows/Build-Docs.yml‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ jobs:
8181
WorkingDirectory: ${{ inputs.WorkingDirectory }}
8282
Script: |
8383
# Rename the gitignore file to .gitignore.bak
84-
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
84+
if (Test-Path -Path .gitignore) {
85+
Rename-Item -Path '.gitignore' -NewName '.gitignore.bak' -Force
86+
}
8587
8688
try {
8789
# Add all changes to the repository
@@ -92,7 +94,9 @@ jobs:
9294
}
9395
9496
# Restore the gitignore file
95-
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
97+
if (Test-Path -Path .gitignore.bak) {
98+
Rename-Item -Path '.gitignore.bak' -NewName '.gitignore' -Force
99+
}
96100
97101
- name: Lint documentation
98102
uses: super-linter/super-linter/slim@latest

0 commit comments

Comments
 (0)