diff --git a/.github/workflows/pr-review-companion.yml b/.github/workflows/pr-review-companion.yml index 7a7128cef..0eb87bb65 100644 --- a/.github/workflows/pr-review-companion.yml +++ b/.github/workflows/pr-review-companion.yml @@ -25,13 +25,17 @@ jobs: - name: Identify PR id: identify-pr run: | - PR_NUMBER=$(gh api repos/${{ github.repository }}/commits/${{ github.event.workflow_run.head_sha }}/pulls --jq '.[0].number') + PR_NUMBER=$(gh api "repos/$HEAD_REPO/commits/$HEAD_SHA/pulls" --jq ".[] | select(.base.repo.full_name == \"$BASE_REPO\") | .number") echo "number=$PR_NUMBER" >> $GITHUB_OUTPUT env: + BASE_REPO: ${{ github.repository }} GITHUB_TOKEN: ${{ github.token }} + HEAD_REPO: ${{ github.event.workflow_run.head_repository.full_name }} + HEAD_SHA: ${{ github.event.workflow_run.head_sha }} deploy: needs: identify-pr + if: needs.identify-pr.outputs.pr-number uses: ./.github/workflows/_deploy.yml secrets: inherit with: @@ -42,6 +46,7 @@ jobs: comment: needs: [identify-pr, deploy] + if: needs.identify-pr.outputs.pr-number runs-on: ubuntu-latest steps: - name: Comment in PR