Skip to content

Commit 53bcb3b

Browse files
committed
Fix Changing Files Without Actually Renaming Them
1 parent b25ec59 commit 53bcb3b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

.github/workflows/ci.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,13 @@ jobs:
5959
$OldName = $File.Name
6060
$NewName = ($File.Name -replace ("${{ github.event.repository.name }}"+$OldSuffix),"${{ env.PKG_NAME }}.")
6161
$NewItem = ("UT2004/${{ env.PKG_NAME }}"+$SubDir+$NewName)
62-
Write-Output ($SubDir + $OldName + " -> " + $SubDir + $NewName)
63-
if (Test-Path -Path $NewItem) { Remove-Item $NewItem }
62+
if ($OldName -eq $NewName) {
63+
Rename-Item -Path $File.FullName -NewName ($File.FullName+".bak")
64+
$File = (Get-Item ($File.FullName+".bak"))
65+
} else {
66+
Write-Output ($SubDir + $OldName + " -> " + $SubDir + $NewName)
67+
if (Test-Path -Path $NewItem) { Remove-Item $NewItem }
68+
}
6469
(Get-Content -Path $File.FullName) | ForEach-Object {
6570
($_ -replace ("${{ github.event.repository.name }}"+$OldSuffix),("${{ env.PKG_NAME }}"+$NewSuffix)) >> $NewItem
6671
}

0 commit comments

Comments
 (0)