@@ -52,19 +52,33 @@ runs:
5252 filter : |
5353 . as $config
5454 | ($config.with // {} | to_entries | map(" \(.key): \(.value | tojson)") | join("\n")) as $inputs
55- | "mkdir -p .tmp.test-action\n" +
56- "cat > .tmp.test-action/action.yml << 'EOFACTION'\n" +
57- "runs:\n" +
58- " using: composite\n" +
59- " steps:\n" +
60- " - uses: \($config.using)\n" +
61- " id: test-action\n" +
62- (if ($inputs | length) > 0 then " with:\n\($inputs)\n" else "" end) +
63- "outputs:\n" +
64- " outputs:\n" +
65- " value: ${{ toJSON(steps.test-action.outputs) }}\n" +
66- "EOFACTION\n"
67- | bash::code
55+ | if ($inputs | length) > 0 then
56+ ("mkdir -p .tmp.test-action\n",
57+ "cat > .tmp.test-action/action.yml << 'EOFACTION'\n",
58+ "runs:\n",
59+ " using: composite\n",
60+ " steps:\n",
61+ " - uses: \($config.using)\n",
62+ " id: test-action\n",
63+ " with:\n",
64+ "\($inputs)\n",
65+ "outputs:\n",
66+ " outputs:\n",
67+ " value: ${{ toJSON(steps.test-action.outputs) }}\n",
68+ "EOFACTION\n") | add
69+ else
70+ ("mkdir -p .tmp.test-action\n",
71+ "cat > .tmp.test-action/action.yml << 'EOFACTION'\n",
72+ "runs:\n",
73+ " using: composite\n",
74+ " steps:\n",
75+ " - uses: \($config.using)\n",
76+ " id: test-action\n",
77+ "outputs:\n",
78+ " outputs:\n",
79+ " value: ${{ toJSON(steps.test-action.outputs) }}\n",
80+ "EOFACTION\n") | add
81+ end
6882
6983 # Run the action under test
7084 - uses : ./.tmp.test-action
@@ -109,15 +123,15 @@ runs:
109123 .expected as $expected
110124 | .actual as $actual
111125 | if $expected == $actual then
112- "echo 'result=pass' >> $GITHUB_OUTPUT\necho '✓ Test passed: outputs match expected values'"
126+ ("echo 'result=pass' >> $GITHUB_OUTPUT\n",
127+ "echo '✓ Test passed: outputs match expected values'\n") | add
113128 else
114- "echo 'result=fail' >> $GITHUB_OUTPUT\n" +
115- "echo '✗ Test failed: outputs do not match'\n" +
116- "echo 'Expected: \($expected | @json)'\n" +
117- "echo 'Actual: \($actual | @json)'\n" +
118- "exit 1"
129+ ( "echo 'result=fail' >> $GITHUB_OUTPUT\n",
130+ "echo '✗ Test failed: outputs do not match'\n",
131+ "echo 'Expected: \($expected | @json)'\n",
132+ "echo 'Actual: \($actual | @json)'\n",
133+ "exit 1\n") | add
119134 end
120- | bash::code
121135
122136 # Set final result
123137 - shell : bash
0 commit comments