diff --git a/.github/uitest/uitest.ps1 b/.github/uitest/uitest.ps1 index 1bd3f4c2d5..579c4b8e62 100644 --- a/.github/uitest/uitest.ps1 +++ b/.github/uitest/uitest.ps1 @@ -134,7 +134,13 @@ function Start-Sample { } } - # set environment variable to the application pool + # add or update environment variable to the application pool + $existingEnvVar = c:\windows\system32\inetsrv\appcmd.exe list config -section:system.applicationHost/applicationPools ` + | out-string ` + | select-xml -XPath "//add[@name='DefaultAppPool']/environmentVariables/add[@name='GITHUB_TOKEN']" + if ($existingEnvVar -ne $null) { + c:\windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /-"[name='DefaultAppPool'].environmentVariables.[name='GITHUB_TOKEN']" /commit:apphost + } c:\windows\system32\inetsrv\appcmd.exe set config -section:system.applicationHost/applicationPools /+"[name='DefaultAppPool'].environmentVariables.[name='GITHUB_TOKEN',value='$env:GITHUB_TOKEN']" /commit:apphost } }