powershell-devops
PowerShell module for dealing with commands in Azure DevOps Pipelines and GitHub Workflows.
GitHub Action
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
Commands
Set-EnvironmentVariable
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
.
Get-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
.
Add-Path
Prepends the value to the PATH environment.
Add-Path $PSScriptRoot
Enter-Group / Exit-Group
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
}
Utility functions
These functions are helper functions that are used by the module but could also be useful within your script.
Test-AdoPipeline
Returns true if running in an Azure DevOps Pipeline, determined by the environment variable TF_BUILD
having a value.
Test-AdoPipeline
Test-GitHubWorkflow
Returns true if running in a GitHub Workflow, determined by the environment variable GITHUB_ACTIONS
having a value.
Test-GitHubWorkflow
License
The scripts and documentation in this project are released under the MIT License
Contributions
Contributions are welcome!