diff --git a/.github/workflows/release-pr.yml b/.github/workflows/release-pr.yml index 2837daa231..c7e23c0bbf 100644 --- a/.github/workflows/release-pr.yml +++ b/.github/workflows/release-pr.yml @@ -33,8 +33,11 @@ jobs: - name: Set up PR Number if: always() run: | - echo "ORIGINAL_PR_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -o "https://github.com/${{ github.repository }}/pull/[0-9]*" | grep -o "[0-9]*")" >> $GITHUB_ENV - echo "CURRENT_PR_NUMBER=${{ github.event.pull_request.number }}" >> $GITHUB_ENV + CURRENT_PR_BODY=$(curl -L -H "Authorization: Bearer ${{ steps.get-token.outputs.token }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}" | jq -r '.body') + echo "CURRENT_PR_BODY=$CURRENT_PR_BODY" >> $GITHUB_ENV + + ORIGINAL_PR_NUMBER=$(echo $CURRENT_PR_BODY | grep -o "https://github.com/${{ github.repository }}/pull/[0-9]*" | grep -o "[0-9]*") + echo "ORIGINAL_PR_NUMBER=$ORIGINAL_PR_NUMBER" >> $GITHUB_ENV - name: Verification Step 1 - link to master PR is added in release PR body if: always() run: | @@ -42,9 +45,9 @@ jobs: echo "Original PR Number extracted: $ORIGINAL_PR_NUMBER" echo "Original PR Url generated: $ORIGINAL_PR_URL" - echo "Pull request body: ${{ github.event.pull_request.body }}" + echo "Current PR body: $CURRENT_PR_BODY" - if [[ "${{ github.event.pull_request.body }}" != *"$ORIGINAL_PR_URL"* ]]; then + if [[ "$CURRENT_PR_BODY" != *"$ORIGINAL_PR_URL"* ]]; then echo "Link to original PR raised against master branch not found in current PR body" exit 1 fi @@ -84,7 +87,7 @@ jobs: files_pr_master=$(echo "$response_pr_master" | jq -r '.[].filename') # Get the JSON response for the second pull request - response_pr_release=$(curl -L -H "Authorization: Bearer ${{ steps.get-token.outputs.token }}" "https://api.github.com/repos/${{ github.repository }}/pulls/$CURRENT_PR_NUMBER/files") + response_pr_release=$(curl -L -H "Authorization: Bearer ${{ steps.get-token.outputs.token }}" "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files") files_pr_release=$(echo "$response_pr_release" | jq -r '.[].filename') # Compare the lists of changed files