Fix Add-EnvPATH on self-hosted Windows

This commit is contained in:
Shivam Mathur 2022-02-22 04:43:32 +05:30
parent 7205f47330
commit 808396c4e6
No known key found for this signature in database
GPG Key ID: 3E13E4C8591ACC2A

View File

@ -118,11 +118,13 @@ Function Add-EnvPATH {
if(-not(Test-Path $EnvPATH)) { if(-not(Test-Path $EnvPATH)) {
return return
} }
$env_file = $current_profile $env_file = $env:GITHUB_ENV
if ($env:GITHUB_ENV) { $env_data = Get-Content -Path $EnvPATH
$env_file = $env:GITHUB_ENV if (-not($env:GITHUB_ENV)) {
$env_file = $current_profile
$env_data = $env_data | ForEach-Object { '$env:' + $_ }
} }
Get-Content -Path $EnvPATH | Add-Content -Path $env_file -Encoding utf8 $env_data | Add-Content -Path $env_file -Encoding utf8
} }
# Function to make sure printf is in PATH. # Function to make sure printf is in PATH.