fix(ci): handle multi-line PR body in linked issues check

Use heredoc to safely write PR body to temp file instead of storing in variable.
This prevents bash from interpreting special characters and multi-line content
as commands (exit code 127 error).

Fixes workflow failure in PR #3.
This commit is contained in:
Reza Rezvani
2025-11-12 14:33:10 +01:00
parent c14b21ccc0
commit 7e9a0e7b01
+6 -2
View File
@@ -80,14 +80,18 @@ jobs:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER="${{ github.event.pull_request.number }}"
PR_BODY="${{ github.event.pull_request.body }}"
echo "Checking for linked issues in PR #$PR_NUMBER"
# Write PR body to temp file to handle multi-line content safely
cat > /tmp/pr_body.txt << 'EOF'
${{ github.event.pull_request.body }}
EOF
# Check for keywords like "Closes", "Fixes", "Resolves", "Relates to"
ISSUE_KEYWORDS="Closes|Fixes|Resolves|Relates to|Ref|References"
if echo "$PR_BODY" | grep -qiE "($ISSUE_KEYWORDS) #[0-9]+"; then
if grep -qiE "($ISSUE_KEYWORDS) #[0-9]+" /tmp/pr_body.txt; then
echo "✅ Found linked issue(s) in PR body"
echo "has-linked-issues=true" >> $GITHUB_OUTPUT
else