Merge pull request #34 from actions/v-nibyko/move-get-go-versions

Moving detection pipelines from Azure DevOps
pull/35/head^2
MaksimZhukov 3 years ago committed by GitHub
commit 1eaa091b65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -29,6 +29,7 @@ if ($ToolName -eq "Xamarin") {
if ($VersionsToBuild) { if ($VersionsToBuild) {
$availableVersions = $VersionsToBuild -join $joinChars $availableVersions = $VersionsToBuild -join $joinChars
Write-Host "The following versions are available to build:`n${availableVersions}" Write-Host "The following versions are available to build:`n${availableVersions}"
Write-Host "::set-output name=TOOL_VERSIONS::${availableVersions}"
Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}" Write-Host "##vso[task.setvariable variable=TOOL_VERSIONS;isOutput=true]${availableVersions}"
} else { } else {
Write-Host "There aren't versions to build" Write-Host "There aren't versions to build"

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

@ -124,6 +124,11 @@ class GitHubApi
} }
} }
[void] CancelWorkflow([string]$WorkflowId) {
$url = "actions/runs/$WorkflowId/cancel"
$this.InvokeRestMethod($url, 'POST', $null, $null)
}
[object] hidden InvokeRestMethod( [object] hidden InvokeRestMethod(
[string] $Url, [string] $Url,
[string] $Method, [string] $Method,

Loading…
Cancel
Save