Open lukemarsden opened 7 months ago
Try adding a \
to the last line too.
Try adding a
\
to the last line too.
Unfortunately that does not work because part of the issue with using a multiline value for the args
input is that either:
The trailing semicolon gets kicked to the next line which internally results in the reported syntax error near unexpected token ';'
, see: https://github.com/dagger/dagger-for-github/blob/51ce834f1ada27473d258df3a1c5733e72c6b860/action.yml#L69
Or if all lines have a trailing backslash and are clipped then the backslashes persist and will confuse Dagger with the observed error of Error: unknown command " --dir=." for "dagger call"
For example, this:
args: |
--env=${{ inputs.environment}} \
--dir=. \
pipeline
Is clipped to an args
value of: --env=*** \ --dir=. \ pipeline
and those inline backslashes are not ignored.
A workaround is to use a block chomping indicator and no backslashes. For example the following will work:
args: >-
--env=${{ inputs.environment}}
--dir=.
pipeline
I think an ideal expected behaviour for the args
input should be to either: (1) handle the various ways yaml can provide a multiline value or (2) parse and throw a more verbose error that prompts users to use the above syntax. Solution 1 is probably out of scope for an action like this. But given that many folks will want to chop up their Dagger call into something readable and maintainable perhaps solution 2 would work simply by parsing the provided args
with a regex and shouting for the user to review either this comment or documentation that recommends this strategy for multiline args
input.
What is the issue?
Given the following config: https://github.com/lukemarsden/test-dagger-actions/blob/c0e90ddf436947e4c6639fd95e2c491095f87ff5/.github/workflows/docker-publish.yml
In particular,
When using the multi-line string
args: |
, I suppose the string ends up including the trailing newline at the end, which results in the following error: https://github.com/lukemarsden/test-dagger-actions/actions/runs/8630455004/job/23656748756In particular:
Switching to single line style, like:
fixes the issue, but of course is less readable
Dagger version
dagger v0.11.0 (registry.dagger.io/engine) darwin/arm64
Steps to reproduce
Run the above config
Log output
See above