Skip to content

Commit af99e56

Browse files
authored
fix: dynamic determinal of commit SHA
1 parent 7816012 commit af99e56

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
@@ -23,7 +23,7 @@ runs:
2323
# Get PR number using GitHub API for different event triggers.
2424
if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
2525
# List PRs associated with the commit, then get the PR number from the head ref or the latest PR.
26-
associated_prs=$(gh api /repos/${{ github.repository }}/commits/${GITHUB_SHA}/pulls --header "$GH_API" --method GET --field per_page=100)
26+
associated_prs=$(gh api /repos/${{ github.repository }}/commits/${{ github.event.pull_request.head.sha || github.sha }}/pulls --header "$GH_API" --method GET --field per_page=100)
2727
number=$(echo "$associated_prs" | jq --raw-output '(.[] | select(.head.ref == env.GITHUB_REF_NAME) | .number) // .[0].number // 0')
2828
elif [[ "$GITHUB_EVENT_NAME" == "merge_group" ]]; then
2929
# Get the PR number by parsing the ref name.

0 commit comments

Comments
 (0)