diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2020-11-13 13:18:20 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2020-11-13 13:19:11 +0300 |
commit | e648fd71905aae0a0a76fb78ed7edf0d526686c3 (patch) | |
tree | 804a5335a13156736129a555eae25360ad0ddada /action.yml | |
parent | add README.md (diff) | |
download | vs-shell-e648fd71905aae0a0a76fb78ed7edf0d526686c3.tar.gz vs-shell-e648fd71905aae0a0a76fb78ed7edf0d526686c3.zip |
do nothing if not on Windows
Diffstat (limited to 'action.yml')
-rw-r--r-- | action.yml | 51 |
1 files changed, 27 insertions, 24 deletions
@@ -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 |