Prevent special character in variable from executing on echo #25947
-
I have a GitHub Actions job where I check whether to continue with deployment by checking the contents of the commit message. Deployment happens only when the commit message is exactly this:
My next job checks whether However, a I understand this has something to do with the |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
The problem is that there are no spaces after So your if needs to be:
|
Beta Was this translation helpful? Give feedback.
-
Thank you so much! Never realised that this was the problem. |
Beta Was this translation helpful? Give feedback.
The problem is that there are no spaces after
[[
and before]]
. The[[
is a bash command, and without the space it’s combined with the first word in the$commitMessage
variable instead, which is no valid command. Additionally string comparison with the[[
or[
commands is just one equals sign. Finally you should quote both sides of the comparison.So your if needs to be: