mirror of
https://github.com/fsecada01/Pygentic-AI.git
synced 2026-05-11 19:54:59 +00:00
fix(ci): use printf for safe JSON handling with special characters
Issue: Secrets with special characters (SSH_PRIVATE_KEY) breaking shell Error: "command not found" due to shell interpreting secret values Root Cause: echo interprets escape sequences and special characters Fix: Use printf '%s' for literal string output Changes: - Replace echo with printf '%s' for safe JSON handling - Filter out github_token (not needed in .env) - Multi-line jq for better readability This fixes multiline secrets (SSH keys, certificates, etc.) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
8
.github/actions/setup-env/action.yml
vendored
8
.github/actions/setup-env/action.yml
vendored
@ -14,8 +14,12 @@ runs:
|
||||
run: |
|
||||
echo "TESTING=true" > .env
|
||||
|
||||
# Parse JSON secrets and write to .env
|
||||
echo '${{ inputs.secrets }}' | jq -r 'to_entries[] | "\(.key)=\(.value)"' >> .env
|
||||
# Use printf to safely handle JSON with special characters
|
||||
printf '%s' '${{ inputs.secrets }}' | jq -r '
|
||||
to_entries[] |
|
||||
select(.key != "github_token") |
|
||||
"\(.key)=\(.value)"
|
||||
' >> .env
|
||||
|
||||
echo "✅ Generated .env with $(wc -l < .env) environment variables"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user