Skip to content

Commit bbfe254

Browse files
authored
fix: push without pr (#358)
Signed-off-by: Rishav Dhar <[email protected]>
1 parent 74126c3 commit bbfe254

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

action.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ runs:
7878
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
7979
# List PRs associated with the commit, then get the PR number from the head ref or the latest PR.
8080
associated_prs=$(gh api /repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/pulls --header "$GH_API" --method GET --field per_page=100)
81-
pr_number=$(echo "$associated_prs" | jq --raw-output '(.[] | select(.head.ref == env.GITHUB_REF_NAME) | .number) // .[0].number')
81+
pr_number=$(echo "$associated_prs" | jq --raw-output '(.[] | select(.head.ref == env.GITHUB_REF_NAME) | .number) // .[0].number // 0')
8282
elif [[ "$GITHUB_EVENT_NAME" == "merge_group" ]]; then
8383
# Get the PR number by parsing the ref name.
8484
pr_number=$(echo "${GITHUB_REF_NAME}" | sed -n 's/.*pr-\([0-9]*\)-.*/\1/p')

0 commit comments

Comments
 (0)