-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write info about queued pipelines back to the tools PR
- Loading branch information
1 parent
1aab5f2
commit 130c5aa
Showing
6 changed files
with
98 additions
and
14 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<br>$commentValue<br>$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
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