Skip to content

Commit e9b1a69

Browse files
committed
indentation fix(3) -- heredoc in tmp file
1 parent 118685e commit e9b1a69

1 file changed

Lines changed: 20 additions & 19 deletions

File tree

.github/workflows/validate-published-rules.yml

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,24 @@ jobs:
9191
run: |
9292
chmod +x open-rules/.github/scripts/run_validation.sh
9393
94+
# Write the JSON-line parser once; called once per test case in the loop below
95+
cat > /tmp/parse_case.py << 'PYEOF'
96+
import sys, json, shlex
97+
d = json.load(sys.stdin)
98+
for k, v in [
99+
('CASE_RULE', d['rule']),
100+
('CASE_TYPE', d['type']),
101+
('CASE_NUM', str(d['num'])),
102+
('EXEC_OK', '\u2705' if d['exec'] else '\u274c'),
103+
('EXPECTED', str(d.get('expected', ''))),
104+
('GOT', str(d.get('got', ''))),
105+
('MATCH', '\u2705' if d.get('match') else '\u274c'),
106+
('DIFF_FILE', str(d.get('diff', ''))),
107+
('STDERR_FILE', str(d.get('stderr', ''))),
108+
]:
109+
print(k + '=' + shlex.quote(v))
110+
PYEOF
111+
94112
PYTHON_CMD="$(pwd)/venv/bin/python"
95113
ENGINE_DIR="$(pwd)/engine"
96114
RULES_ROOT="$(pwd)/open-rules"
@@ -154,25 +172,8 @@ jobs:
154172
155173
if [ -f "$CASE_RESULTS" ]; then
156174
while IFS= read -r line; do
157-
# Parse all fields in a single python3 call using shlex.quote
158-
# to safely produce shell variable assignments
159-
eval "$(echo "$line" | python3 <<'PY'
160-
import sys, json, shlex
161-
d = json.load(sys.stdin)
162-
for k, v in [
163-
('CASE_RULE', d['rule']),
164-
('CASE_TYPE', d['type']),
165-
('CASE_NUM', str(d['num'])),
166-
('EXEC_OK', '✅' if d['exec'] else '❌'),
167-
('EXPECTED', str(d.get('expected', ''))),
168-
('GOT', str(d.get('got', ''))),
169-
('MATCH', '✅' if d.get('match') else '❌'),
170-
('DIFF_FILE', str(d.get('diff', ''))),
171-
('STDERR_FILE', str(d.get('stderr', ''))),
172-
]:
173-
print(k + '=' + shlex.quote(v))
174-
'PY'
175-
)"
175+
# Parse all fields in a single python3 call — script written once above
176+
eval "$(echo "$line" | python3 /tmp/parse_case.py)"
176177
177178
echo "| $CASE_RULE | $CASE_TYPE | $CASE_NUM | $EXEC_OK | $EXPECTED | $GOT | $MATCH |" >> "$SUMMARY_TABLE"
178179

0 commit comments

Comments
 (0)