@@ -12,17 +12,30 @@ jobs:
1212 steps :
1313 - name : Get Current PR Body
1414 id : current_pr
15- env :
16- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
1715 run : |
18- # Fetching fresh PR body via gh cli is more reliable than event payload for 'edited'
19- PR_BODY=${{ github.event.pull_request.body }}
20- # Make body safe for multiline output
21- PR_BODY="${PR_BODY//'%'/'%25'}"
22- PR_BODY="${PR_BODY//$'\n'/'%0A'}"
23- PR_BODY="${PR_BODY//$'\r'/'%0D'}"
16+ # Use the PR body directly from the event payload
17+ # This is the body as it was when the 'opened' or 'edited' event was triggered.
18+ RAW_PR_BODY="${{ github.event.pull_request.body }}"
19+
20+ # Handle cases where the body might be null (e.g., an empty PR description)
21+ # In bash, an unset or null variable in quotes becomes an empty string,
22+ # but it's good practice to be explicit or test.
23+ # If RAW_PR_BODY is null from the JSON payload, it will be treated as an empty string here by bash.
24+ # For more robust null handling if needed elsewhere: PR_BODY_FOR_SCRIPT="${RAW_PR_BODY:-}"
25+ PR_BODY_FOR_SCRIPT="$RAW_PR_BODY"
26+
27+ echo "PR Body from event payload (first 500 chars):"
28+ echo "${PR_BODY_FOR_SCRIPT:0:500}" # Print a snippet for logging
29+ echo "-------------------"
30+
31+ # If you need to pass this body to subsequent steps via GITHUB_OUTPUT,
32+ # the multiline escaping is still crucial.
33+ ESCAPED_PR_BODY="${RAW_PR_BODY//'%'/'%25'}"
34+ ESCAPED_PR_BODY="${ESCAPED_PR_BODY//$'\n'/'%0A'}"
35+ ESCAPED_PR_BODY="${ESCAPED_PR_BODY//$'\r'/'%0D'}"
36+
2437 echo "PR_BODY_CONTENT<<EOF" >> $GITHUB_OUTPUT
25- echo "$PR_BODY " >> $GITHUB_OUTPUT
38+ echo "$ESCAPED_PR_BODY " >> $GITHUB_OUTPUT
2639 echo "EOF" >> $GITHUB_OUTPUT
2740
2841 - name : Extract Remote PR URL and Info
0 commit comments