File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -79,8 +79,8 @@ function Test-Hash {
7979 number
8080 title
8181 body
82+ baseRefName
8283 }
83- }
8484 }
8585 rateLimit {
8686 remaining
@@ -116,7 +116,7 @@ function Test-Hash {
116116 $message = @ (' You are right. Thank you for reporting.' )
117117 # TODO: Post labels at the end of function
118118 Add-Label - ID $IssueID - Label ' verified' , ' hash-fix-needed'
119- $prs = $prs | Where-Object { $_.title -eq $titleToBePosted }
119+ $prs = $prs | Where-Object { $_.title -eq $titleToBePosted -and $_ .baseRefName -eq $masterBranch }
120120
121121 # There is alreay PR for
122122 if ($prs.Count -gt 0 ) {
@@ -140,7 +140,8 @@ function Test-Hash {
140140 try {
141141 $isProtected = ((Invoke-GithubRequest " repos/$REPOSITORY /branches/$masterBranch " ).Content | ConvertFrom-Json ).protected
142142 } catch {
143- Write-Log " Failed to check branch protection status: $ ( $_.Exception.Message ) "
143+ Write-Log " Failed to check branch protection status: $ ( $_.Exception.Message ) . Assuming branch is protected for safety."
144+ $isProtected = $true
144145 $isProtected = $false
145146 }
146147
Original file line number Diff line number Diff line change @@ -143,7 +143,10 @@ function Invoke-GithubGraphQLParallel {
143143
144144 try {
145145 $response = Invoke-WebRequest @parameters
146- return @ { Success = $true ; Data = $response }
146+ $payload = $response.Content | ConvertFrom-Json
147+ if ($payload.errors ) {
148+ return @ { Success = $false ; Error = ($payload.errors | ConvertTo-Json - Depth 10 ) }
149+ }
147150 return @ { Success = $true ; Data = $response }
148151 } catch {
149152 return @ { Success = $false ; Error = $_.Exception.Message }
You can’t perform that action at this time.
0 commit comments