Skip to content

Commit eb4fb70

Browse files
authored
Merge pull request #78 from iMattPro/fix-windows
Fix windows again
2 parents 10ad591 + 2f5dbe3 commit eb4fb70

1 file changed

Lines changed: 10 additions & 16 deletions

File tree

.github/workflows/tests.yml

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -697,22 +697,6 @@ jobs:
697697
Enable-WindowsOptionalFeature -Online -FeatureName IIS-WebServerRole, IIS-WebServer, IIS-CommonHttpFeatures, IIS-ManagementConsole, IIS-HttpErrors, IIS-HttpRedirect, IIS-WindowsAuthentication, IIS-StaticContent, IIS-DefaultDocument, IIS-HttpCompressionStatic, IIS-DirectoryBrowsing, IIS-WebServerManagementTools, IIS-CGI -All
698698
Set-Service wuauserv -StartupType Manual
699699
$webConfig = "${env:GITHUB_WORKSPACE}\phpBB3\phpBB\web.config"
700-
# Install URL Rewrite with retries because Chocolatey feed requests can timeout on GitHub runners.
701-
$installed = $false
702-
for ($i = 1; $i -le 3; $i++) {
703-
try {
704-
choco install urlrewrite -y --no-progress
705-
$installed = $true
706-
break
707-
} catch {
708-
Write-Warning "URL Rewrite install attempt $i failed: $($_.Exception.Message)"
709-
Start-Sleep -Seconds (10 * $i)
710-
}
711-
}
712-
if (-not $installed) {
713-
throw "Failed to install URL Rewrite after 3 attempts."
714-
}
715-
# Only patch web.config after rewrite is installed.
716700
$content = Get-Content $webConfig -Raw
717701
$content = $content.Replace(
718702
"<configuration>",
@@ -722,6 +706,16 @@ jobs:
722706
"`t</system.webServer>",
723707
"`t`t<httpErrors errorMode=`"Detailed`" />`n`t</system.webServer>"
724708
)
709+
$rewriteInstalled = $false
710+
try {
711+
choco install urlrewrite -y --no-progress
712+
$rewriteInstalled = $true
713+
} catch {
714+
Write-Warning "URL Rewrite installation failed; continuing without rewrite-specific IIS configuration."
715+
}
716+
if (-not $rewriteInstalled) {
717+
$content = $content -replace "(?s)`r?`n\s*<rewrite>.*?</rewrite>", ""
718+
}
725719
Set-Content $webConfig -Value $content -Encoding UTF8
726720
Import-Module WebAdministration
727721
New-WebSite -Name 'phpBBTest' -PhysicalPath "${env:GITHUB_WORKSPACE}\phpBB3\phpBB" -Force

0 commit comments

Comments
 (0)