Skip to content

Commit da2bb7d

Browse files
committed
fix: use heredoc with placeholders to avoid shell interpretation
- Use heredoc with placeholders instead of variable substitution - Process commits safely through temporary file - Completely prevent shell command interpretation
1 parent e5a698e commit da2bb7d

File tree

1 file changed

+18
-8
lines changed

1 file changed

+18
-8
lines changed

.github/workflows/integrate-develop.yml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -130,14 +130,24 @@ jobs:
130130
# Get current PR body
131131
CURRENT_BODY=$(gh pr view $PR_NUMBER --json body --jq '.body')
132132
133-
# Create updated section safely using file approach
134-
{
135-
echo "### 🔄 Last Updated: ${TIMESTAMP}"
136-
echo "New commits: ${COMMIT_COUNT}"
137-
echo ""
138-
echo "### 📝 Recent Commits"
139-
echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g'
140-
} > updated-section.md
133+
# Create updated section with escaped content
134+
cat > updated-section.md << 'EOF'
135+
### 🔄 Last Updated: TIMESTAMP_PLACEHOLDER
136+
New commits: COUNT_PLACEHOLDER
137+
138+
### 📝 Recent Commits
139+
COMMITS_PLACEHOLDER
140+
EOF
141+
142+
# Replace placeholders safely
143+
sed -i "s/TIMESTAMP_PLACEHOLDER/${TIMESTAMP}/g" updated-section.md
144+
sed -i "s/COUNT_PLACEHOLDER/${COMMIT_COUNT}/g" updated-section.md
145+
146+
# Process commits separately and safely
147+
echo "${COMMITS}" | sed 's/%0A/\n/g' | sed 's/%0D//g' | sed 's/%25/%/g' > commits-temp.txt
148+
sed -i '/COMMITS_PLACEHOLDER/r commits-temp.txt' updated-section.md
149+
sed -i '/COMMITS_PLACEHOLDER/d' updated-section.md
150+
141151
UPDATED_SECTION=$(cat updated-section.md)
142152

143153
# Update or append the updated section

0 commit comments

Comments
 (0)