I have a composite run steps action that takes a few inputs, for which I provide default values. I’m running into problems with special characters; for example, my default string contains a single quote and ends with a colon.
According to my reading of the YAML spec (and articles like this one), I should be able to single quote the string and escape the inner single quote by doubling it:
inputs: header: description: The header string required: false default: 'It''s okay:'
However, when I use this action and don’t provide a value for
header, I get the following error:
Run ./.github/actions/prtodolist with: header: It's okay: /home/runner/work/_temp/ad293103-cfab-4449-bd16-3335bc379c0a.sh: line 6: unexpected EOF while looking for matching `'' Error: Process completed with exit code 2.
which seems to be an error from the shell – and indeed, when I modify the string so it can be safely expanded by the shell, as in
default: 'It\''s okay:'
It\'s okay: and doesn’t trip up the shell.
Similarly, trying to use a default string with a markdown link:
inputs: footer: description: The footer required: false default: '[Link text](https://git.io/abcde)'
results in an error
Run ./.github/actions/prtodolist with: header: It\'s okay: footer: [Link text](https://git.io/abcde) /home/runner/work/_temp/7a7dd51a-0495-4172-9a31-f5ba5d25ebf8.sh: line 7: syntax error near unexpected token `(' Error: Process completed with exit code 2.
which can be avoided by preparing the string so it still is single quoted after YAML expansion:
default: '''[Link text](https://git.io/abcde)'''
which apparently becomes
'[Link text](https://git.io/abcde)', as far as the shell is concerned.
Is this expected? It feels like there’s an unexpected unquoted shell expansion happening somewhere, or the behaviour isn’t documented. In any case, it’s surprising behaviour.