From fbe38f7fb35deb6636328341badf6d694ef544f4 Mon Sep 17 00:00:00 2001 From: Azure SDK Bot <53356347+azure-sdk@users.noreply.github.com> Date: Mon, 1 Nov 2021 13:40:53 -0700 Subject: [PATCH] Sync eng/common directory with azure-sdk-tools for PR 2177 (#3016) * Create an issue template * rename the function * Add description * Update eng/common/scripts/Invoke-GitHubAPI.ps1 Co-authored-by: Wes Haggard Co-authored-by: Sima Zhu Co-authored-by: Sima Zhu <48036328+sima-zhu@users.noreply.github.com> Co-authored-by: Wes Haggard --- eng/common/scripts/Invoke-GitHubAPI.ps1 | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/eng/common/scripts/Invoke-GitHubAPI.ps1 b/eng/common/scripts/Invoke-GitHubAPI.ps1 index 5d2981f01..0f0469b8f 100644 --- a/eng/common/scripts/Invoke-GitHubAPI.ps1 +++ b/eng/common/scripts/Invoke-GitHubAPI.ps1 @@ -157,6 +157,36 @@ function New-GitHubPullRequest { -MaximumRetryCount 3 } +function New-GitHubIssue { + param ( + [Parameter(Mandatory = $true)] + $RepoOwner, + [Parameter(Mandatory = $true)] + $RepoName, + [Parameter(Mandatory = $true)] + $Title, + [Parameter(Mandatory = $true)] + $Description, + [ValidateNotNullOrEmpty()] + [Parameter(Mandatory = $true)] + $AuthToken + ) + + $uri = "$GithubAPIBaseURI/$RepoOwner/$RepoName/issues" + + $parameters = @{ + title = $Title + body = $Description + } + + return Invoke-RestMethod ` + -Method POST ` + -Body ($parameters | ConvertTo-Json) ` + -Uri $uri ` + -Headers (Get-GitHubApiHeaders -token $AuthToken) ` + -MaximumRetryCount 3 +} + function Add-GitHubIssueComment { param ( [Parameter(Mandatory = $true)]