Skip to content

Commit 5016c52

Browse files
Copilotphlax
andcommitted
Fix jq filter syntax: remove non-existent bash::code, use string arrays with add
Co-authored-by: phlax <454682+phlax@users.noreply.github.com>
1 parent 952cd79 commit 5016c52

File tree

3 files changed

+34
-22
lines changed

3 files changed

+34
-22
lines changed

gh-actions/bson/tests/basic.test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ with:
77
input-format: yaml
88
filter: |
99
"echo \(.message)"
10-
| bash::code
1110
1211
after:
1312
- shell: bash

gh-actions/test-runner/action.yml

Lines changed: 34 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -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

gh-actions/test-runner/tests/gh-mock-example.test.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ with:
2323
which gh
2424
gh api test-endpoint
2525
"
26-
| bash::code
2726
2827
after:
2928
- shell: bash

0 commit comments

Comments
 (0)