Skip to content

Commit b6f32aa

Browse files
authored
Sync eng/common directory with azure-sdk-tools for PR 2177 (Azure#21523)
1 parent ecfd1e0 commit b6f32aa

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

eng/common/scripts/Invoke-GitHubAPI.ps1

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,36 @@ function New-GitHubPullRequest {
157157
-MaximumRetryCount 3
158158
}
159159

160+
function New-GitHubIssue {
161+
param (
162+
[Parameter(Mandatory = $true)]
163+
$RepoOwner,
164+
[Parameter(Mandatory = $true)]
165+
$RepoName,
166+
[Parameter(Mandatory = $true)]
167+
$Title,
168+
[Parameter(Mandatory = $true)]
169+
$Description,
170+
[ValidateNotNullOrEmpty()]
171+
[Parameter(Mandatory = $true)]
172+
$AuthToken
173+
)
174+
175+
$uri = "$GithubAPIBaseURI/$RepoOwner/$RepoName/issues"
176+
177+
$parameters = @{
178+
title = $Title
179+
body = $Description
180+
}
181+
182+
return Invoke-RestMethod `
183+
-Method POST `
184+
-Body ($parameters | ConvertTo-Json) `
185+
-Uri $uri `
186+
-Headers (Get-GitHubApiHeaders -token $AuthToken) `
187+
-MaximumRetryCount 3
188+
}
189+
160190
function Add-GitHubIssueComment {
161191
param (
162192
[Parameter(Mandatory = $true)]

0 commit comments

Comments
 (0)