aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/action.yml
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-11-13 13:18:20 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-11-13 13:19:11 +0300
commite648fd71905aae0a0a76fb78ed7edf0d526686c3 (patch)
tree804a5335a13156736129a555eae25360ad0ddada /action.yml
parentadd README.md (diff)
downloadvs-shell-e648fd71905aae0a0a76fb78ed7edf0d526686c3.tar.gz
vs-shell-e648fd71905aae0a0a76fb78ed7edf0d526686c3.zip
do nothing if not on Windows
Diffstat (limited to '')
-rw-r--r--action.yml51
1 files changed, 27 insertions, 24 deletions
diff --git a/action.yml b/action.yml
index a418c44..ab49669 100644
--- a/action.yml
+++ b/action.yml
@@ -85,34 +85,37 @@ runs:
}
}
- $old_values = @{}
- Get-ChildItem env: | %{ $old_values.Add($_.Name, $_.Value) }
-
- $info = Locate-VS
- try {
- Import-PS $info
- } catch {
- echo $_
- Import-CMD $info
- }
-
- $new_values = @{}
- Get-ChildItem env: | %{ $new_values.Add($_.Name, $_.Value) }
+ if ('${{ runner.os }}' -ne 'Windows') {
+ echo 'Not going to set up a Visual Studio shell on ${{ runner.os }}'
+ } else {
+ $old_values = @{}
+ Get-ChildItem env: | %{ $old_values.Add($_.Name, $_.Value) }
+
+ $info = Locate-VS
+ try {
+ Import-PS $info
+ } catch {
+ echo $_
+ Import-CMD $info
+ }
- # Some diagnostics as to which exact variables were modified follows:
- echo '----------------------------------------------------------------'
- echo 'New variables'
- echo '----------------------------------------------------------------'
- $new_values.GetEnumerator() | where { -not $old_values.ContainsKey($_.Name) } | Format-List
+ $new_values = @{}
+ Get-ChildItem env: | %{ $new_values.Add($_.Name, $_.Value) }
- echo '----------------------------------------------------------------'
- echo 'Modified variables'
- echo '----------------------------------------------------------------'
- $new_values.GetEnumerator() | where { $old_values.ContainsKey($_.Name) -and $old_values[$_.Name] -ne $_.Value } | Format-List
+ # Some diagnostics as to which exact variables were modified follows:
+ echo '----------------------------------------------------------------'
+ echo 'New variables'
+ echo '----------------------------------------------------------------'
+ $new_values.GetEnumerator() | where { -not $old_values.ContainsKey($_.Name) } | Format-List
+ echo '----------------------------------------------------------------'
+ echo 'Modified variables'
+ echo '----------------------------------------------------------------'
+ $new_values.GetEnumerator() | where { $old_values.ContainsKey($_.Name) -and $old_values[$_.Name] -ne $_.Value } | Format-List
- # Update the current environment:
- Get-ChildItem env: | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV }
+ # Update the current environment:
+ Get-ChildItem env: | %{ echo "$($_.Name)=$($_.Value)" >> $env:GITHUB_ENV }
+ }
shell: pwsh
branding:
icon: star