-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Sync eng/common directory with azure-sdk-tools for PR 1052 (#468)
* Update location of patch files * Add some changes in eng/common to test things * Switch to pushing to upstream * Change workflow to use upstream branches Co-authored-by: Chidozie Ononiwu <chononiw@microsoft.com>
- Loading branch information
1 parent
dc58527
commit ef865bc
Showing
6 changed files
with
135 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
[CmdletBinding(SupportsShouldProcess = $true)] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$RepoOwner, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$RepoName, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$IssueNumber, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string]$CommentPrefix, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$Comment, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string]$CommentPostFix, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$AuthToken | ||
) | ||
|
||
. "${PSScriptRoot}\logging.ps1" | ||
|
||
$headers = @{ | ||
Authorization = "bearer $AuthToken" | ||
} | ||
|
||
$apiUrl = "https://api.github.com/repos/$RepoOwner/$RepoName/issues/$IssueNumber/comments" | ||
|
||
$commentPrefixValue = [System.Environment]::GetEnvironmentVariable($CommentPrefix) | ||
$commentValue = [System.Environment]::GetEnvironmentVariable($Comment) | ||
$commentPostFixValue = [System.Environment]::GetEnvironmentVariable($CommentPostFix) | ||
|
||
if (!$commentPrefixValue) { $commentPrefixValue = $CommentPrefix } | ||
if (!$commentValue) { $commentValue = $Comment } | ||
if (!$commentPostFixValue) { $commentPostFixValue = $CommentPostFix } | ||
|
||
$PRComment = "$commentPrefixValue $commentValue $commentPostFixValue" | ||
|
||
$data = @{ | ||
body = $PRComment | ||
} | ||
|
||
try { | ||
$resp = Invoke-RestMethod -Method POST -Headers $headers -Uri $apiUrl -Body ($data | ConvertTo-Json) | ||
} | ||
catch { | ||
LogError "Invoke-RestMethod [ $apiUrl ] failed with exception:`n$_" | ||
exit 1 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
[CmdletBinding(SupportsShouldProcess = $true)] | ||
param( | ||
[Parameter(Mandatory = $true)] | ||
[string]$Organization, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$Project, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$SourceBranch, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[int]$DefinitionId, | ||
|
||
[Parameter(Mandatory = $false)] | ||
[string]$VsoQueuedPipelines, | ||
|
||
[Parameter(Mandatory = $true)] | ||
[string]$AuthToken | ||
) | ||
|
||
. "${PSScriptRoot}\logging.ps1" | ||
|
||
$headers = @{ | ||
Authorization = "Basic $AuthToken" | ||
} | ||
|
||
$apiUrl = "https://dev.azure.com/$Organization/$Project/_apis/build/builds?api-version=6.0" | ||
|
||
$body = @{ | ||
sourceBranch = $SourceBranch | ||
definition = @{ id = $DefinitionId } | ||
} | ||
|
||
Write-Verbose ($body | ConvertTo-Json) | ||
|
||
try { | ||
$resp = Invoke-RestMethod -Method POST -Headers $headers $apiUrl -Body ($body | ConvertTo-Json) -ContentType application/json | ||
} | ||
catch { | ||
LogError "Invoke-RestMethod [ $apiUrl ] failed with exception:`n$_" | ||
exit 1 | ||
} | ||
|
||
LogDebug "Pipeline [ $($resp.definition.name) ] queued at [ $($resp._links.web.href) ]" | ||
|
||
if ($VsoQueuedPipelines) { | ||
$enVarValue = [System.Environment]::GetEnvironmentVariable($VsoQueuedPipelines) | ||
$QueuedPipelineLinks = if ($enVarValue) { | ||
"$enVarValue<br>[$($resp.definition.name)]($($resp._links.web.href))" | ||
}else { | ||
"[$($resp.definition.name)]($($resp._links.web.href))" | ||
} | ||
$QueuedPipelineLinks | ||
Write-Host "##vso[task.setvariable variable=$VsoQueuedPipelines]$QueuedPipelineLinks" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters