Skip to content

Commit 2cc9e68

Browse files
committed
fix(workflow): improve translation saving process by escaping special characters to ensure correct file creation
1 parent 317eaf9 commit 2cc9e68

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

.github/workflows/generate-readme-translations.yml

+9-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@ jobs:
7272
7373
- name: Save translation
7474
run: |
75-
mv translated.md README_${{ matrix.language.code }}.md
75+
# Create a temporary variable with the translation
76+
translation='${{ steps.aixion.outputs.text }}'
77+
# Escape any quotes and special characters
78+
translation="${translation//\"/\\\"}"
79+
translation="${translation//'%'/'%25'}"
80+
translation="${translation//$'\n'/'%0A'}"
81+
translation="${translation//$'\r'/'%0D'}"
82+
# Write the escaped content to file
83+
echo "$translation" > README_${{ matrix.language.code }}.md
7684
7785
- name: List README translations
7886
run: ls README_*.md || echo "No translation files found"

0 commit comments

Comments
 (0)