Skip to content

Commit bbd6502

Browse files
committed
fix a bug
1 parent 9d20a10 commit bbd6502

File tree

1 file changed

+4
-33
lines changed

1 file changed

+4
-33
lines changed

.github/workflows/code-execution.yml

Lines changed: 4 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -64,42 +64,13 @@ jobs:
6464
fi
6565
6666
# 使用 base64 解码确保源代码中的空格和特殊字符被正确保留
67-
# 首先将源代码写入临时文件,然后检查并确保文件格式正确
68-
echo "${{ github.event.inputs.source_code }}" > source_code_temp.txt || true
69-
70-
echo "=== Source Code (Before Processing) ===" || true
71-
cat source_code_temp.txt || true
72-
echo "=====================================" || true
73-
74-
# 修复可能的空格问题,将连续的 << 后面的空格保留
75-
sed -i 's/<< *;/<< " ";/g' source_code_temp.txt || true
76-
sed -i 's/<< *)/<< " ")/g' source_code_temp.txt || true
77-
sed -i 's/<< *,/<< " ",/g' source_code_temp.txt || true
78-
sed -i 's/<< *$/<< " "/g' source_code_temp.txt || true
79-
sed -i 's/<< *\]/<< " "]/g' source_code_temp.txt || true
80-
sed -i 's/<< *}/<< " "}/g' source_code_temp.txt || true
81-
sed -i 's/<< *>/<< " ">/g' source_code_temp.txt || true
82-
83-
# 处理 >> 运算符周围的空格
84-
sed -i 's/>> *;/>> " ";/g' source_code_temp.txt || true
85-
sed -i 's/>> *)/>> " ")/g' source_code_temp.txt || true
86-
sed -i 's/>> *,/>> " ",/g' source_code_temp.txt || true
87-
sed -i 's/>> *$/>> " "/g' source_code_temp.txt || true
88-
sed -i 's/>> *\]/>> " "]/g' source_code_temp.txt || true
89-
sed -i 's/>> *}/>> " "}/g' source_code_temp.txt || true
90-
sed -i 's/>> *>/>> " ">/g' source_code_temp.txt || true
91-
92-
# 修复Python语法错误:__main__ 需要引号
93-
sed -i 's/__main__:/"__main__":/g' source_code_temp.txt || true
94-
95-
echo "=== Source Code (After Processing) ===" || true
96-
cat source_code_temp.txt || true
97-
echo "====================================" || true
98-
cat source_code_temp.txt > $SOURCE_FILE || true
67+
echo "=== Decoding Base64 Source Code ===" || true
68+
echo "${{ github.event.inputs.source_code }}" | base64 -d > $SOURCE_FILE || true
69+
echo "===================================" || true
9970
10071
# 确保源代码文件是 UTF-8 编码
10172
echo "=== Converting to UTF-8 ===" || true
102-
iconv -f ISO-8859-1 -t UTF-8 $SOURCE_FILE -o $SOURCE_FILE.utf8 || true
73+
iconv -f UTF-8 -t UTF-8 $SOURCE_FILE -o $SOURCE_FILE.utf8 2>/dev/null || cp $SOURCE_FILE $SOURCE_FILE.utf8
10374
mv $SOURCE_FILE.utf8 $SOURCE_FILE || true
10475
echo "=========================" || true
10576

0 commit comments

Comments
 (0)