PowerShell module for dealing with commands in Azure DevOps Pipelines and GitHub Workflows.
See action.yml for detailed list of inputs.
Basic:
steps:
- uses: smokedlinq/powershell-devops@v0
Specific version:
steps:
- uses: smokedlinq/powershell-devops@v0
with:
required-version: 0.0.7
Minimum version:
steps:
- uses: smokedlinq/powershell-devops@v0
with:
minimum-version: 0.0.7
Maximum version:
steps:
- uses: smokedlinq/powershell-devops@v0
with:
maximum-version: 0.0.7
Sets the environment variable for the current process and optionally marks it as a secret.
set-env MY_VALUE 'Hello World!'
Note: set-env
is an alias for Set-EnvironmentVariable
.
Gets the environment variable for the current process and optionally throws an error if it is not defined.
get-env MY_ENV_VALUE -Require
Note: get-env
is an alias for Get-EnvironmentVariable
.
Prepends the value to the PATH environment.
Add-Path $PSScriptRoot
Creates an expandable group in the log. Anything you print to the log between the Enter-Group
and Exit-Group
commands is nested inside an expandable entry in the log.
Enter-Group 'My group'
try {
# .. some other commands ...
} finally {
Exit-Group
}
These functions enhance the behavior of existing cmdlets to operate more concisely in the DevOps environment.
Writes the message as a warning and optionally converts the input to JSON.
@{
Target = 'Target'
Message = 'Message'
} | Write-Warning -AsJson
Write-Warning "Warning"
Note: JSON objects are always compressed to fit on a single line.
Writes the message as verbose and optionally converts the input to JSON.
@{
Target = 'Target'
Message = 'Message'
} | Write-Verbose -AsJson
Write-Verbose "Verbose"
Note: JSON objects are always compressed to fit on a single line.
Writes the message as debug and optionally converts the input to JSON.
@{
Target = 'Target'
Message = 'Message'
} | Write-Debug -AsJson
Write-Debug "Debug"
Note: JSON objects are always compressed to fit on a single line.
These functions are helper functions that are used by the module but could also be useful within your script.
Returns true if running in an Azure DevOps Pipeline, determined by the environment variable TF_BUILD
having a value.
Test-AdoPipeline
Returns true if running in a GitHub Workflow, determined by the environment variable GITHUB_ACTIONS
having a value.
Test-GitHubWorkflow
The scripts and documentation in this project are released under the MIT License
Contributions are welcome!