Skip to content

Commit f599d88

Browse files
committed
chore: fix multiline output
Signed-off-by: Justin Chadwell <[email protected]>
1 parent f2957ff commit f599d88

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

.github/workflows/test.yml

+22-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
with:
2929
version: latest
3030
verb: core
31-
args: container from --address=alpine with-exec --args echo,"hello world" stdout
31+
args: container from --address=alpine with-exec --args echo,-n,"hello world" stdout
3232
- name: "Use output (check)"
3333
run: |
3434
target='${{ steps.use-output.outputs.output }}'
@@ -40,13 +40,33 @@ jobs:
4040
exit 1
4141
fi
4242
43+
- name: "Use trailing output"
44+
id: use-trailing-output
45+
uses: ./
46+
with:
47+
version: latest
48+
verb: core
49+
args: container from --address=alpine with-exec --args echo,-n,-e,"hello world\n" stdout
50+
- name: "Use output (check)"
51+
run: |
52+
target='${{ steps.use-trailing-output.outputs.output }}'
53+
result='hello world
54+
'
55+
if [[ "$target" == "$result" ]]; then
56+
echo "matches"
57+
exit 0
58+
else
59+
echo "does not match"
60+
exit 1
61+
fi
62+
4363
- name: "Use multiline output"
4464
id: use-multiline-output
4565
uses: ./
4666
with:
4767
version: latest
4868
verb: core
49-
args: container from --address=alpine with-exec --args echo,-e,"hello\nworld" stdout
69+
args: container from --address=alpine with-exec --args echo,-n,-e,"hello\nworld" stdout
5070
- name: "Use output (check)"
5171
run: |
5272
target='${{ steps.use-multiline-output.outputs.output }}'

action.yml

+10-1
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,16 @@ runs:
8383
${INPUT_MODULE:+-m $INPUT_MODULE} \
8484
${{ inputs.args }}; } | tee "${tmpout}"
8585
86-
(echo -n "stdout=" && cat "${tmpout}") >> "$GITHUB_OUTPUT"
86+
{
87+
# we need a delim that doesn't appear in the output - a hash of the
88+
# file itself *probably* won't (if it does, we have larger
89+
# cryptographic problems)
90+
delim="$(sha256sum $tmpout | cut -d " " -f1)"
91+
echo "stdout<<${delim}"
92+
cat "${tmpout}"
93+
echo
94+
echo "${delim}"
95+
} >> "$GITHUB_OUTPUT"
8796
8897
- if: inputs.engine-stop == 'true'
8998
shell: bash

0 commit comments

Comments
 (0)