mirror of
https://github.com/hanzoai/azure-sdk-for-js.git
synced 2026-10-30 19:51:51 +00:00
Sync eng/common directory with azure-sdk-tools for PR https://github.com/Azure/azure-sdk-tools/pull/6919 See [eng/common workflow](https://github.com/Azure/azure-sdk-tools/blob/main/eng/common/README.md#workflow) --------- Co-authored-by: Patrick Hallisey <[email protected]>
25 lines
887 B
PowerShell
25 lines
887 B
PowerShell
param(
|
|
[string]$Variable,
|
|
[switch]$IsOutput
|
|
)
|
|
|
|
$repoUrl = $env:BUILD_REPOSITORY_URI
|
|
$sourceBranch = $env:BUILD_SOURCEBRANCH
|
|
|
|
$description = "[$sourceBranch]($repoUrl/tree/$sourceBranch)"
|
|
if ($sourceBranch -match "^refs/heads/(.+)$") {
|
|
$description = "Branch: [$($Matches[1])]($repoUrl/tree/$sourceBranch)"
|
|
} elseif ($sourceBranch -match "^refs/tags/(.+)$") {
|
|
$description = "Tag: [$($Matches[1])]($repoUrl/tree/$sourceBranch)"
|
|
} elseif ($sourceBranch -match "^refs/pull/(\d+)/(head|merge)$") {
|
|
$description = "Pull request: $repoUrl/pull/$($Matches[1])"
|
|
}
|
|
|
|
if ($IsOutput) {
|
|
Write-Host "Setting output variable '$Variable' to '$description'"
|
|
Write-Host "##vso[task.setvariable variable=$Variable;isoutput=true]$description"
|
|
} else {
|
|
Write-Host "Setting variable '$Variable' to '$description'"
|
|
Write-Host "##vso[task.setvariable variable=$Variable]$description"
|
|
}
|