I have something like the following in a Github Actions workflow:
on: issue_comment: types: [created] jobs: job: name: My job if: startsWith(github.event.comment.body, 'foo') || contains(github.event.comment.body, '\nfoo')
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: