mirror of
https://github.com/dagger/dagger-for-github.git
synced 2026-01-03 21:49:50 +11:00
chore: fix multiline output
Signed-off-by: Justin Chadwell <me@jedevc.com>
This commit is contained in:
parent
f2957ff708
commit
f599d88d33
2 changed files with 32 additions and 3 deletions
24
.github/workflows/test.yml
vendored
24
.github/workflows/test.yml
vendored
|
|
@ -28,7 +28,7 @@ jobs:
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
verb: core
|
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)"
|
- name: "Use output (check)"
|
||||||
run: |
|
run: |
|
||||||
target='${{ steps.use-output.outputs.output }}'
|
target='${{ steps.use-output.outputs.output }}'
|
||||||
|
|
@ -40,13 +40,33 @@ jobs:
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
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"
|
- name: "Use multiline output"
|
||||||
id: use-multiline-output
|
id: use-multiline-output
|
||||||
uses: ./
|
uses: ./
|
||||||
with:
|
with:
|
||||||
version: latest
|
version: latest
|
||||||
verb: core
|
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)"
|
- name: "Use output (check)"
|
||||||
run: |
|
run: |
|
||||||
target='${{ steps.use-multiline-output.outputs.output }}'
|
target='${{ steps.use-multiline-output.outputs.output }}'
|
||||||
|
|
|
||||||
11
action.yml
11
action.yml
|
|
@ -83,7 +83,16 @@ runs:
|
||||||
${INPUT_MODULE:+-m $INPUT_MODULE} \
|
${INPUT_MODULE:+-m $INPUT_MODULE} \
|
||||||
${{ inputs.args }}; } | tee "${tmpout}"
|
${{ inputs.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.engine-stop == 'true'
|
- if: inputs.engine-stop == 'true'
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue