Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,58 @@ jobs:
exit 1
fi

call-multiline-backslash:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: "Test call with backslash continuation"
id: test-call-backslash
uses: ./
with:
version: latest
verb: core
args: |-
container \
from --address=alpine \
with-exec --args echo,-n,"hello world" \
stdout
- name: "Test call backslash (check)"
run: |
target='${{ steps.test-call-backslash.outputs.output }}'
if [[ "$target" == "hello world" ]]; then
echo "matches"
exit 0
else
echo "does not match: $target"
exit 1
fi

call-multiline-newline:
runs-on: "ubuntu-latest"
steps:
- uses: actions/checkout@v4
- name: "Test call with bare newlines"
id: test-call-newline
uses: ./
with:
version: latest
verb: core
args: |-
container
from --address=alpine
with-exec --args echo,-n,"hello world"
stdout
- name: "Test call newline (check)"
run: |
target='${{ steps.test-call-newline.outputs.output }}'
if [[ "$target" == "hello world" ]]; then
echo "matches"
exit 0
else
echo "does not match: $target"
exit 1
fi

check:
runs-on: "ubuntu-latest"
steps:
Expand Down
9 changes: 5 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,11 @@ runs:
run: |
verb=${{ inputs.verb }}
shell=$(echo '${{ toJSON(inputs.shell) }}' | jq -rj .)
dagger_flags=$(echo '${{ toJSON(inputs.dagger-flags) }}' | jq -rj .)
args=$(echo '${{ toJSON(inputs.args) }}' | jq -rj .)
call=$(echo '${{ toJSON(inputs.call) }}' | jq -rj .)
check=$(echo '${{ toJSON(inputs.check) }}' | jq -rj .)
# Collapse backslash-continuations and newlines into spaces for CLI args
dagger_flags=$(echo '${{ toJSON(inputs.dagger-flags) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
args=$(echo '${{ toJSON(inputs.args) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
call=$(echo '${{ toJSON(inputs.call) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
check=$(echo '${{ toJSON(inputs.check) }}' | jq -rj . | sed -z 's/\\\n/ /g; s/\n/ /g')
if [[ -n "${{ inputs.call }}" ]]; then
verb="call"
elif [[ -n "$check" ]]; then
Expand Down