Skip to content

Commit

Permalink
chore: fix multiline output
Browse files Browse the repository at this point in the history
Signed-off-by: Justin Chadwell <me@jedevc.com>
  • Loading branch information
jedevc committed Nov 11, 2024
1 parent f9a4c9f commit b292eff
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 3 deletions.
24 changes: 22 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
with:
version: latest
verb: core
args: container from --address=alpine with-exec --args echo,"hello world" stdout
args: container from --address=alpine with-exec --args echo,-n,"hello world" stdout
- name: "Use output (check)"
run: |
target='${{ steps.use-output.outputs.output }}'
Expand All @@ -40,13 +40,33 @@ jobs:
exit 1
fi
- name: "Use trailing output"
id: use-trailing-output
uses: ./
with:
version: latest
verb: core
args: container from --address=alpine with-exec --args echo,-n,-e,"hello world\n" stdout
- name: "Use output (check)"
run: |
target='${{ steps.use-trailing-output.outputs.output }}'
result='hello world
'
if [[ "$target" == "$result" ]]; then
echo "matches"
exit 0
else
echo "does not match"
exit 1
fi
- name: "Use multiline output"
id: use-multiline-output
uses: ./
with:
version: latest
verb: core
args: container from --address=alpine with-exec --args echo,-e,"hello\nworld" stdout
args: container from --address=alpine with-exec --args echo,-n,-e,"hello\nworld" stdout
- name: "Use output (check)"
run: |
target='${{ steps.use-multiline-output.outputs.output }}'
Expand Down
11 changes: 10 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,16 @@ runs:
${INPUT_MODULE:+-m $INPUT_MODULE} \
$ARGS; } | tee "${tmpout}"
(echo -n "stdout=" && cat "${tmpout}") >> "$GITHUB_OUTPUT"
{
# we need a delim that doesn't appear in the output - a hash of the
# file itself *probably* won't (if it does, we have larger
# cryptographic problems)
delim="$(sha256sum $tmpout | cut -d " " -f1)"
echo "stdout<<${delim}"
cat "${tmpout}"
echo
echo "${delim}"
} >> "$GITHUB_OUTPUT"
- if: (inputs.call != '' || inputs.args != '') && inputs.engine-stop == 'true'
shell: bash
Expand Down

0 comments on commit b292eff

Please sign in to comment.