11Join-Path $PSScriptRoot ' ..\Helpers.psm1' | Import-Module
2+ Join-Path $PSScriptRoot ' ..\Github.psm1' | Import-Module
23Join-Path $PSScriptRoot ' Issue' | Get-ChildItem - Filter ' *.psm1' | Select-Object - ExpandProperty Fullname | Import-Module
34
4- function Invoke-GithubGraphQLQuery {
5- <#
6- . SYNOPSIS
7- Execute a GraphQL query to GitHub API.
8- . PARAMETER Query
9- GraphQL query string.
10- . PARAMETER Variables
11- Hashtable of variables for the query.
12- #>
13- param (
14- [Parameter (Mandatory )]
15- [String ] $Query ,
16- [Hashtable ] $Variables
17- )
18-
19- $graphqlUrl = ' https://api.github.com/graphql'
20- $body = @ { ' query' = $Query }
21- if ($Variables ) { $body [' variables' ] = $Variables }
22-
23- $parameters = @ {
24- ' Headers' = @ {
25- ' Authorization' = " Bearer $env: GITHUB_TOKEN "
26- ' Accept' = ' application/json'
27- }
28- ' Method' = ' Post'
29- ' Uri' = $graphqlUrl
30- ' Body' = (ConvertTo-Json $body - Depth 10 )
31- ' ContentType' = ' application/json'
32- }
33-
34- Write-Log ' GraphQL Request' $parameters.Uri
355
36- $response = Invoke-WebRequest @parameters
37- $env: GH_REQUEST_COUNTER = ([int ] $env: GH_REQUEST_COUNTER ) + 1
38-
39- return $response
40- }
416
427function Test-Hash {
438 param (
@@ -128,7 +93,7 @@ function Test-Hash {
12893
12994 try {
13095 Write-Log ' Attempting GraphQL query for repository and PRs...'
131- $response = Invoke-GithubGraphQLQuery - Query $graphqlQuery - Variables @ {
96+ $response = Invoke-GithubGraphQL - Query $graphqlQuery - Variables @ {
13297 owner = $owner
13398 repo = $repo
13499 }
@@ -145,7 +110,7 @@ function Test-Hash {
145110 Write-Log " GraphQL query failed, falling back to REST API: $ ( $_.Exception.Message ) "
146111 # Fallback to REST API
147112 $masterBranch = ((Invoke-GithubRequest " repos/$REPOSITORY " ).Content | ConvertFrom-Json ).default_branch
148- $prs = (Invoke-GithubRequest " repos/$REPOSITORY /pulls?state=open&base=$masterBranch &sorting =updated" ).Content | ConvertFrom-Json
113+ $prs = (Invoke-GithubRequest " repos/$REPOSITORY /pulls?state=open&base=$masterBranch &sort =updated" ).Content | ConvertFrom-Json
149114 }
150115
151116 $message = @ (' You are right. Thank you for reporting.' )
0 commit comments