Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 34 additions & 10 deletions .github/workflows/react-native-cicd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -301,13 +301,23 @@ jobs:
# Function to extract release notes from PR body
extract_release_notes() {
local body="$1"

# Remove "Summary by CodeRabbit" section (including any content under it until the next header)
local cleaned_body="$(printf '%s\n' "$body" \
| awk '
BEGIN { skip=0 }
/^## Summary by CodeRabbit/ { skip=1; next }
/^## / && skip==1 { skip=0 }
skip==0 { print }
')"

# Try to extract content under "## Release Notes" heading
local notes="$(printf '%s\n' "$body" \
local notes="$(printf '%s\n' "$cleaned_body" \
| awk 'f && /^## /{exit} /^## Release Notes/{f=1; next} f')"

# If no specific section found, use the entire body (up to first 500 chars for safety)
# If no specific section found, use the entire cleaned body (up to first 500 chars for safety)
if [ -z "$notes" ]; then
notes="$(printf '%s\n' "$body" | head -c 500)"
notes="$(printf '%s\n' "$cleaned_body" | head -c 500)"
fi

printf '%s\n' "$notes"
Expand Down Expand Up @@ -402,13 +412,27 @@ jobs:
--arg commitSha "${{ github.sha }}" \
--arg buildUrl "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" \
'{
version: $version,
releaseNotes: $notes,
platform: $platform,
buildNumber: $buildNumber,
commitSha: $commitSha,
buildUrl: $buildUrl,
timestamp: now | todate
"version": $version,
"title": "Release v" + $version,
"content": "$notes",
"tags": [
{
"id": "platform",
"name": "$platform"
},
{
"id": "buildNumber",
"name": "$buildNumber"
},
{
"id": "commitSha",
"name": "$commitSha"
},
{
"id": "buildUrl",
"name": "$buildUrl"
}
]
}')
Comment on lines 414 to 436
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: Fix jq variable interpolation in JSON payload construction.

The jq filter uses quoted variable references ("$variable") within string literals, which treats them as literal strings rather than interpolating the actual values. This will cause the payload to contain literal $notes, $platform, etc. instead of their actual values.

Apply this diff to fix the variable references:

             '{
-              "version": $version,
-              "title": "Release v" + $version,
-              "content": "$notes",
+              "version": $version,
+              "title": ("Release v" + $version),
+              "content": $notes,
               "tags": [
                 {
                   "id": "platform",
-                  "name": "$platform"
+                  "name": $platform
                 },
                 {
                   "id": "buildNumber",
-                  "name": "$buildNumber"
+                  "name": $buildNumber
                 },
                 {
                   "id": "commitSha",
-                  "name": "$commitSha"
+                  "name": $commitSha
                 },
                 {
                   "id": "buildUrl",
-                  "name": "$buildUrl"
+                  "name": $buildUrl
                 }
               ]
             }')
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
'{
version: $version,
releaseNotes: $notes,
platform: $platform,
buildNumber: $buildNumber,
commitSha: $commitSha,
buildUrl: $buildUrl,
timestamp: now | todate
"version": $version,
"title": "Release v" + $version,
"content": "$notes",
"tags": [
{
"id": "platform",
"name": "$platform"
},
{
"id": "buildNumber",
"name": "$buildNumber"
},
{
"id": "commitSha",
"name": "$commitSha"
},
{
"id": "buildUrl",
"name": "$buildUrl"
}
]
}')
'{
"version": $version,
"title": ("Release v" + $version),
"content": $notes,
"tags": [
{
"id": "platform",
"name": $platform
},
{
"id": "buildNumber",
"name": $buildNumber
},
{
"id": "commitSha",
"name": $commitSha
},
{
"id": "buildUrl",
"name": $buildUrl
}
]
}')
🤖 Prompt for AI Agents
.github/workflows/react-native-cicd.yml around lines 414 to 436: the jq filter
currently wraps variables in quotes inside JSON strings so they become literal
names (e.g. "$notes"); fix by passing each CI variable into jq with --arg (for
string values) or --argjson (for numeric/JSON values like version/buildNumber if
appropriate) and then reference them unquoted in the jq expression (use $notes,
$platform, $buildNumber, $commitSha, $buildUrl, $version) so jq interpolates the
actual values into the JSON payload.


echo "Sending release notes to Changerawr..."
Expand Down
Loading