Skip to content

Commit

Permalink
fix filtering and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Mar 5, 2024
1 parent b197005 commit 100e42d
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions .github/workflows/updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -151,21 +151,18 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
$data = gh api 'repos/${{ github.repository }}/pulls?base=${{ steps.root.outputs.baseBranch }}&head=${{ steps.root.outputs.prBranch }}'
Write-Host $data
$prCount = $($data | jq '. | length')
if ($prCount -eq '0')
$urls = @(gh api 'repos/${{ github.repository }}/pulls?base=${{ steps.root.outputs.baseBranch }}&head=${{ github.repository_owner }}:${{ steps.root.outputs.prBranch }}' --jq '.[].html_url')
if ($urls.Length -eq 0)
{
"url=" | Tee-Object $env:GITHUB_OUTPUT -Append
}
elseif ($prCount -eq '1')
elseif ($urls.Length -eq 1)
{
$url = $($data | Select-String '"html_url": +"(.*/pull/.*)"').Matches[0].Groups[1].Value
"url=$url" | Tee-Object $env:GITHUB_OUTPUT -Append
"url=$($urls[0])" | Tee-Object $env:GITHUB_OUTPUT -Append
}
else
{
throw "Unexpected number of PRs matched: $prCount"
throw "Unexpected number of PRs matched ($($urls.Length)): $urls"
}
- run: git --no-pager diff
Expand Down

0 comments on commit 100e42d

Please sign in to comment.