|
|
|
@ -7,11 +7,13 @@ Required parameter. Incoming Webhook URL to post a message
|
|
|
|
|
.PARAMETER ToolName
|
|
|
|
|
Required parameter. The name of tool
|
|
|
|
|
.PARAMETER ToolVersion
|
|
|
|
|
Required parameter. Specifies the version of tool
|
|
|
|
|
Optional parameter. Specifies the version of tool
|
|
|
|
|
.PARAMETER PipelineUrl
|
|
|
|
|
Required parameter. The pipeline URL
|
|
|
|
|
Optional parameter. The pipeline URL
|
|
|
|
|
.PARAMETER ImageUrl
|
|
|
|
|
Optional parameter. The image URL
|
|
|
|
|
.PARAMETER Text
|
|
|
|
|
Optional parameter. The message to post
|
|
|
|
|
#>
|
|
|
|
|
|
|
|
|
|
param(
|
|
|
|
@ -23,25 +25,25 @@ param(
|
|
|
|
|
[ValidateNotNullOrEmpty()]
|
|
|
|
|
[System.String]$ToolName,
|
|
|
|
|
|
|
|
|
|
[Parameter(Mandatory)]
|
|
|
|
|
[ValidateNotNullOrEmpty()]
|
|
|
|
|
[System.String]$ToolVersion,
|
|
|
|
|
|
|
|
|
|
[System.String]$PipelineUrl,
|
|
|
|
|
[System.String]$ImageUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png'
|
|
|
|
|
[System.String]$ImageUrl = 'https://github.githubassets.com/images/modules/logos_page/GitHub-Mark.png',
|
|
|
|
|
[System.String]$Text
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Import helpers module
|
|
|
|
|
Import-Module $PSScriptRoot/helpers.psm1 -DisableNameChecking
|
|
|
|
|
|
|
|
|
|
# Create JSON body
|
|
|
|
|
if ($toolName -eq "Xamarin") {
|
|
|
|
|
$text = "The following versions of '$toolName' are available, consider adding them to toolset: $toolVersion"
|
|
|
|
|
} else {
|
|
|
|
|
$text = "The following versions of '$toolName' are available to upload: $toolVersion"
|
|
|
|
|
}
|
|
|
|
|
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
|
|
|
|
|
$text += "\nLink to the pipeline: $pipelineUrl"
|
|
|
|
|
if ([string]::IsNullOrWhiteSpace($Text)) {
|
|
|
|
|
if ($toolName -eq "Xamarin") {
|
|
|
|
|
$Text = "The following versions of '$toolName' are available, consider adding them to toolset: $toolVersion"
|
|
|
|
|
} else {
|
|
|
|
|
$Text = "The following versions of '$toolName' are available to upload: $toolVersion"
|
|
|
|
|
}
|
|
|
|
|
if (-not ([string]::IsNullOrWhiteSpace($PipelineUrl))) {
|
|
|
|
|
$Text += "\nLink to the pipeline: $pipelineUrl"
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
$jsonBodyMessage = @"
|
|
|
|
|
{
|
|
|
|
@ -50,7 +52,7 @@ $jsonBodyMessage = @"
|
|
|
|
|
"type": "section",
|
|
|
|
|
"text": {
|
|
|
|
|
"type": "mrkdwn",
|
|
|
|
|
"text": "$text"
|
|
|
|
|
"text": "$Text"
|
|
|
|
|
},
|
|
|
|
|
"accessory": {
|
|
|
|
|
"type": "image",
|
|
|
|
|