pwsh-script icon indicating copy to clipboard operation
pwsh-script copied to clipboard

Suggestion to improve $*Preference defaults

Open felixfbecker opened this issue 3 years ago • 0 comments
trafficstars

One thing I found myself always prepending to all my GitHub action PowerShell script is setting $ProgressPreference and $InformationPreference.

  • $ProgressPreference to 'Silent', because on the GitHub action log PowerShell cannot draw an interactive progress bar and it otherwise causes mangled output
  • $InformationPreference to 'SilentlyContinue' (instead of default 'Silent') because in GitHub actions you usually want to be able to log text with Write-Information (and the pipeline output is used as the action output). And can be a bit of a debugging pitfall to realize that Write-Information is swallowed).

What do you think about adding these two lines to the action itself so they don't have to be added manually? I think it would improve the developer experience and not be harmful (and worse case it can be overridden by the user)

Happy to do a PR.

felixfbecker avatar Feb 03 '22 20:02 felixfbecker