Searching for a substring with a newline using the "contains" function #25134
-
I have something like the following in a Github Actions workflow:
The intention is that the job only runs if a comment is posted that contains “foo” at the start of a line. However, the second clause never seems to fire. I suspect this is because ‘\n’ is not being interpreted as a newline character. Are special characters in literals escaped in a different way? How should I rewrite my workflow so that the job will run when I post a comment like:
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
You can set to return the value of github.event.comment.body as JSON-type via the toJson function. In the JSON-type, the line-break will be converted to ’ \r\n’.
|
Beta Was this translation helpful? Give feedback.
-
Thank you, that works perfectly! |
Beta Was this translation helpful? Give feedback.
@bryangingechen ,
You can set to return the value of github.event.comment.body as JSON-type via the toJson function. In the JSON-type, the line-break will be converted to ’ \r\n’.