@@ -145,39 +145,24 @@ jobs:
145
145
Write-Output "::warning::Target branch '$prBranch' has been changed manually - skipping updater to avoid overwriting these changes."
146
146
}
147
147
148
- - name : Fetch an existing PR
149
- if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
150
- uses : octokit/request-action@89697eb6635e52c6e1e5559f15b5c91ba5100cb0 # v2.1.9
151
- id : existing-pr-request
152
- with :
153
- route : GET /repos/${{ github.repository }}/pulls?base={base}&head={head}
154
- head : ' ${{ github.repository }}:${{ steps.root.outputs.prBranch }}'
155
- base : ' ${{ steps.root.outputs.baseBranch }}'
156
- env :
157
- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
158
-
159
148
- name : Parse the existing PR URL
160
149
if : ${{ ( steps.target.outputs.latestTag != steps.target.outputs.originalTag ) && ( steps.root.outputs.changed == 'false') }}
161
150
id : existing-pr
151
+ env :
152
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
162
153
run : |
163
- $data = @'
164
- ${{ steps.existing-pr-request.outputs.data }}
165
- '@
166
-
167
- $prCount = $($data | jq '. | length')
168
-
169
- if ($prCount -eq '0')
154
+ $urls = @(gh api 'repos/${{ github.repository }}/pulls?base=${{ steps.root.outputs.baseBranch }}&head=${{ github.repository_owner }}:${{ steps.root.outputs.prBranch }}' --jq '.[].html_url')
155
+ if ($urls.Length -eq 0)
170
156
{
171
157
"url=" | Tee-Object $env:GITHUB_OUTPUT -Append
172
158
}
173
- elseif ($prCount -eq '1' )
159
+ elseif ($urls.Length -eq 1 )
174
160
{
175
- $url = $($data | Select-String '"html_url": +"(.*/pull/.*)"').Matches[0].Groups[1].Value
176
- "url=$url" | Tee-Object $env:GITHUB_OUTPUT -Append
161
+ "url=$($urls[0])" | Tee-Object $env:GITHUB_OUTPUT -Append
177
162
}
178
163
else
179
164
{
180
- throw "Unexpected number of PRs matched: $prCount "
165
+ throw "Unexpected number of PRs matched ($($urls.Length)) : $urls "
181
166
}
182
167
183
168
- run : git --no-pager diff
0 commit comments