From 8fca8b2fc72b52db614acf2f69058c331acf857b Mon Sep 17 00:00:00 2001 From: Praveen Kuttappan Date: Wed, 8 Dec 2021 13:47:16 -0500 Subject: [PATCH] Added new API to get list of github issues --- eng/common/scripts/Invoke-GitHubAPI.ps1 | 27 +++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/eng/common/scripts/Invoke-GitHubAPI.ps1 b/eng/common/scripts/Invoke-GitHubAPI.ps1 index 0f0469b8fe..90c1ff6389 100644 --- a/eng/common/scripts/Invoke-GitHubAPI.ps1 +++ b/eng/common/scripts/Invoke-GitHubAPI.ps1 @@ -187,6 +187,33 @@ function New-GitHubIssue { -MaximumRetryCount 3 } +function Get-GitHubIssues { + param ( + [Parameter(Mandatory = $true)] + $RepoOwner, + [Parameter(Mandatory = $true)] + $RepoName, + $CreatedBy, + [Parameter(Mandatory = $true)] + $Labels, + [ValidateNotNullOrEmpty()] + [Parameter(Mandatory = $true)] + $AuthToken + ) + + $uri = "$GithubAPIBaseURI/$RepoOwner/$RepoName/issues?labels=$Labels" + + if ($CreatedBy) { + $uri += "&creator=$CreatedBy" + } + + return Invoke-RestMethod ` + -Method GET ` + -Uri $uri ` + -Headers (Get-GitHubApiHeaders -token $AuthToken) ` + -MaximumRetryCount 3 +} + function Add-GitHubIssueComment { param ( [Parameter(Mandatory = $true)]