Skip to content

Commit

Permalink
fix: correct logic to extract PR number in report workflow (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
reubeno authored Jul 14, 2024
1 parent 6d9035e commit 981ea71
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion .github/workflows/ci-reports.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ jobs:
head_branch=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_branch')
head_sha=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_sha')
head_repo=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_repository.full_name')
head_repo_owner=$(echo '${{ steps.find-run.outputs.data }}' | jq -r '.head_repository.owner.login')
if [[ "${head_branch}" != "" && "${head_repo}" != "" ]]; then
pr_number="$(gh pr view -R "${head_repo}" "${head_branch}" --json number -q '.number' || true)"
pr_number="$(gh pr list --state open --json number,headRefName,headRepositoryOwner,headRepository,baseRefName -q "map(select(.headRefName == \"${head_branch}\" and .headRepositoryOwner.login == \"${head_repo_owner}\" and .baseRefName == \"main\")) | .[0].number" || true)"
else
pr_number=""
fi
Expand Down

0 comments on commit 981ea71

Please sign in to comment.