File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,6 +236,58 @@ jobs:
236236 exit 1
237237 fi
238238
239+ call-multiline-backslash :
240+ runs-on : " ubuntu-latest"
241+ steps :
242+ - uses : actions/checkout@v4
243+ - name : " Test call with backslash continuation"
244+ id : test-call-backslash
245+ uses : ./
246+ with :
247+ version : latest
248+ verb : core
249+ args : |-
250+ container \
251+ from --address=alpine \
252+ with-exec --args echo,-n,"hello world" \
253+ stdout
254+ - name : " Test call backslash (check)"
255+ run : |
256+ target='${{ steps.test-call-backslash.outputs.output }}'
257+ if [[ "$target" == "hello world" ]]; then
258+ echo "matches"
259+ exit 0
260+ else
261+ echo "does not match: $target"
262+ exit 1
263+ fi
264+
265+ call-multiline-newline :
266+ runs-on : " ubuntu-latest"
267+ steps :
268+ - uses : actions/checkout@v4
269+ - name : " Test call with bare newlines"
270+ id : test-call-newline
271+ uses : ./
272+ with :
273+ version : latest
274+ verb : core
275+ args : |-
276+ container
277+ from --address=alpine
278+ with-exec --args echo,-n,"hello world"
279+ stdout
280+ - name : " Test call newline (check)"
281+ run : |
282+ target='${{ steps.test-call-newline.outputs.output }}'
283+ if [[ "$target" == "hello world" ]]; then
284+ echo "matches"
285+ exit 0
286+ else
287+ echo "does not match: $target"
288+ exit 1
289+ fi
290+
239291 check :
240292 runs-on : " ubuntu-latest"
241293 steps :
Original file line number Diff line number Diff line change @@ -133,10 +133,11 @@ runs:
133133 run : |
134134 verb=${{ inputs.verb }}
135135 shell=$(echo '${{ toJSON(inputs.shell) }}' | jq -rj .)
136- dagger_flags=$(echo '${{ toJSON(inputs.dagger-flags) }}' | jq -rj .)
137- args=$(echo '${{ toJSON(inputs.args) }}' | jq -rj .)
138- call=$(echo '${{ toJSON(inputs.call) }}' | jq -rj .)
139- check=$(echo '${{ toJSON(inputs.check) }}' | jq -rj .)
136+ # Collapse backslash-continuations and newlines into spaces for CLI args
137+ dagger_flags=$(echo '${{ toJSON(inputs.dagger-flags) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
138+ args=$(echo '${{ toJSON(inputs.args) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
139+ call=$(echo '${{ toJSON(inputs.call) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
140+ check=$(echo '${{ toJSON(inputs.check) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
140141 if [[ -n "${{ inputs.call }}" ]]; then
141142 verb="call"
142143 elif [[ -n "$check" ]]; then
You can’t perform that action at this time.
0 commit comments