Skip to content

fix(deploy): remove heredoc from SSH deploy script causing step 6 failure#2

Open
Copilot wants to merge 2 commits intomainfrom
copilot/update-documentation-for-quanttrade-ai
Open

fix(deploy): remove heredoc from SSH deploy script causing step 6 failure#2
Copilot wants to merge 2 commits intomainfrom
copilot/update-documentation-for-quanttrade-ai

Conversation

Copy link
Contributor

Copilot AI commented Mar 3, 2026

The "Deploy to EC2" step was exiting with status 1 immediately after the first echo, traced to a cat > .env << 'ENVEOF' heredoc that both breaks under SSH piped script execution and is dead code (immediately overwritten by the subsequent { } > .env block).

Changes

  • Remove heredoc — eliminates cat > .env << 'ENVEOF' ... ENVEOF block; heredoc terminators are unreliable when scripts are transmitted via SSH pipe
  • Move header into { } > .env block — preserves the # Auto-generated + timestamp comment as echo statements inside the block that actually writes the file
  • Add mkdir -p /opt/quanttrade — defensive guard before cd for fresh-server deployments where SCP may not have pre-created the directory
-            cat > .env << 'ENVEOF'
-            # Auto-generated by GitHub Actions deploy
-            # Last updated: $(date -u +"%Y-%m-%dT%H:%M:%SZ")
-            ENVEOF
-
-            # Write each secret (only if non-empty)
             {
+              echo "# Auto-generated by GitHub Actions deploy"
+              echo "# Last updated: $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
               echo "# === Database ==="
Original prompt

Reference: https://github.com/YashJoshi2109/QuantTrade-AI/actions/runs/22621071007/job/65547152259#step:6:1


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

@YashJoshi2109 YashJoshi2109 marked this pull request as ready for review March 3, 2026 11:50
…ailure

The deploy.yml script was failing immediately after the first echo in the
'Deploy to EC2' step. The cause was a `cat > .env << 'ENVEOF'` heredoc that:
1. Was immediately overwritten by the { } > .env block (dead code)
2. Can fail when scripts are piped through SSH connections

Changes:
- Removed the useless cat > .env heredoc block
- Added header comments as echo statements inside the existing { } > .env block
- Added mkdir -p /opt/quanttrade for defensive coding on fresh servers

Co-authored-by: YashJoshi2109 <60288342+YashJoshi2109@users.noreply.github.com>
Copilot AI changed the title [WIP] Update documentation for QuantTrade AI project fix(deploy): remove heredoc from SSH deploy script causing step 6 failure Mar 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants