We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4126333 commit 1ed055bCopy full SHA for 1ed055b
.github/workflows/preview.yml
@@ -20,10 +20,13 @@ jobs:
20
steps:
21
- name: Get PR number
22
id: pr
23
+ env:
24
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25
run: |
- PR_NUMBER="${{ github.event.workflow_run.pull_requests[0].number }}"
- if [ -z "$PR_NUMBER" ] || [ "$PR_NUMBER" = "0" ]; then
26
- echo "No PR number found"
+ PR_NUMBER=$(gh api repos/${{ github.repository }}/pulls \
27
+ --jq ".[] | select(.head.sha == \"${{ github.event.workflow_run.head_sha }}\") | .number")
28
+ if [ -z "$PR_NUMBER" ]; then
29
+ echo "No PR found for SHA ${{ github.event.workflow_run.head_sha }}"
30
exit 1
31
fi
32
echo "number=$PR_NUMBER" >> "$GITHUB_OUTPUT"
0 commit comments