Modify Windows deployment script to check $env:SKIP before adding swimm-verify to it

This commit is contained in:
shreyamalviya 2021-04-28 13:32:30 +05:30
parent 05dd10cd96
commit 9383457518
1 changed files with 9 additions and 1 deletions

View File

@ -25,7 +25,15 @@ function Configure-precommit([String] $git_repo_dir)
Pop-Location
# Set env variable to skip Swimm verification during pre-commit, Windows not supported yet
[System.Environment]::SetEnvironmentVariable('SKIP','swimm-verify',[System.EnvironmentVariableTarget]::User)
$skipValue = [System.Environment]::GetEnvironmentVariable('SKIP', [System.EnvironmentVariableTarget]::User)
if ($skipValue) { # if `SKIP` is not empty
if (-Not ($skipValue -split ',' -contains 'swimm-verify')) { # if `SKIP` doesn't already have "swimm-verify"
[System.Environment]::SetEnvironmentVariable('SKIP', $env:SKIP + ',swimm-verify', [System.EnvironmentVariableTarget]::User)
}
}
else {
[System.Environment]::SetEnvironmentVariable('SKIP', 'swimm-verify', [System.EnvironmentVariableTarget]::User)
}
Write-Output "Pre-commit successfully installed"
}