Skip to content

Commit b292eff

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

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

.github/workflows/test.yml

Lines changed: 22 additions & 2 deletions
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

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,16 @@ runs:
9090
${INPUT_MODULE:+-m $INPUT_MODULE} \
9191
$ARGS; } | tee "${tmpout}"
9292
93-
(echo -n "stdout=" && cat "${tmpout}") >> "$GITHUB_OUTPUT"
93+
{
94+
# we need a delim that doesn't appear in the output - a hash of the
95+
# file itself *probably* won't (if it does, we have larger
96+
# cryptographic problems)
97+
delim="$(sha256sum $tmpout | cut -d " " -f1)"
98+
echo "stdout<<${delim}"
99+
cat "${tmpout}"
100+
echo
101+
echo "${delim}"
102+
} >> "$GITHUB_OUTPUT"
94103
95104
- if: (inputs.call != '' || inputs.args != '') && inputs.engine-stop == 'true'
96105
shell: bash

0 commit comments

Comments
 (0)