File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1818 shell : bash
1919 run : |
2020 # Fallback on empty string if the branch is not found.
21- branch=${{ github.ref_name || github.head_ref || github.ref || '' }}
21+ branch=${{ github.ref_name || github.head_ref || github.ref || '0 ' }}
2222
2323 # Get PR number using GitHub API for different event triggers.
2424 if [[ "$GITHUB_EVENT_NAME" == "push" ]]; then
3030 number=$(echo "${GITHUB_REF_NAME}" | sed -n 's/.*pr-\([0-9]*\)-.*/\1/p')
3131 else
3232 # Get the PR number from branch name, otherwise fallback on 0 if the PR number is not found.
33- number=$(gh api /repos/{owner}/{repo}/pulls --header "$GH_API" --method GET --field per_page=100 --field head="${branch}" | jq .[0].number) || ${{ github.event.number || github.event.issue.number || 0 }}
33+ number=${{ github.event.number || github.event.issue.number }} || $ (gh api /repos/{owner}/{repo}/pulls --header "$GH_API" --method GET --field per_page=100 --field head="${branch}" | jq ' .[0].number // 0')
3434 fi
3535
3636 echo "branch=$branch" >> "$GITHUB_OUTPUT"
You can’t perform that action at this time.
0 commit comments