Skip to content

Commit 02a16cd

Browse files
[HOTFIX] Regression fix for PR numbers
Changes in file .github/workflows/CI-BUILD.yml: * store PR number in the build info for use in reports
1 parent 53df1b1 commit 02a16cd

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

.github/workflows/CI-BUILD.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,6 +302,8 @@ jobs:
302302
environment: ${{ steps.check_status.outputs.build_environment }}
303303
steps:
304304
- id: check_status
305+
env:
306+
GH_TOKEN: ${{ github.token }}
305307
run: |
306308
if [[ "${{ needs.BUILD.result }}" == "success" && "${{ needs.BOOTSTRAP.result }}" == "success" ]]; then
307309
printf "%s\n" "build_success=true" >> "$GITHUB_OUTPUT"
@@ -323,7 +325,14 @@ jobs:
323325
if [[ "${{ github.event_name }}" == "pull_request" ]]; then
324326
printf "%s\n" "build_pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT
325327
else
326-
printf "%s\n" "build_pr_number=null" >> $GITHUB_OUTPUT
328+
PRS_LIST=$(gh pr list --state open --head "${{ github.repository }}:${{ github.ref_name }}" --json number --jq '.[].number')
329+
# Determine the highest pull request number or set to null
330+
if [[ -n "${PRS_LIST}" ]]; then
331+
highest_pr_number=$(printf "%s\n" "$PRS_LIST" | sort -n | tail -n 1)
332+
echo "build_pr_number=$highest_pr_number" >> $GITHUB_OUTPUT
333+
else
334+
echo "build_pr_number=null" >> $GITHUB_OUTPUT
335+
fi
327336
fi
328337
printf "%s\n" "build_environment=${ENVIRONMENT}" >> "$GITHUB_OUTPUT"
329338
printf "%s\n" "build_id=${{ github.run_id }}" >> "$GITHUB_OUTPUT"

0 commit comments

Comments
 (0)