From b43c1b22ab1ae1c128a0bfb9e3db2355b01e1bc6 Mon Sep 17 00:00:00 2001 From: Qianhao Dong Date: Mon, 24 Aug 2026 14:18:10 +0800 Subject: [PATCH] fix: test --- .github/workflows/verify-devpack-scripts.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/verify-devpack-scripts.yml b/.github/workflows/verify-devpack-scripts.yml index a5e22c1..3352a35 100644 --- a/.github/workflows/verify-devpack-scripts.yml +++ b/.github/workflows/verify-devpack-scripts.yml @@ -296,10 +296,16 @@ jobs: } Write-Host "ARP: $($entry.DisplayName) $($entry.DisplayVersion)" - if ($env:INSTALL_SOURCE -eq 'winget') { + $identity = [Security.Principal.WindowsIdentity]::GetCurrent() + $principal = [Security.Principal.WindowsPrincipal]::new($identity) + $isElevated = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator) + if ($env:INSTALL_SOURCE -eq 'winget' -and -not $isElevated) { winget uninstall --exact --id Microsoft.FoundryDevPack --source winget ` --silent --disable-interactivity --accept-source-agreements } else { + if ($env:INSTALL_SOURCE -eq 'winget') { + Write-Host 'Runner is elevated; using the persisted uninstaller for this user-scope package.' + } & $entry.DisplayIcon uninstall } if ($LASTEXITCODE -ne 0) { throw "uninstall exited $LASTEXITCODE" }