Event strings use Windows-style line endings irrespective of runner OS

I am not sure if I’m the first one who noticed this idiosyncracy, but GitHub Actions seems to use CRLF-style line endings in their event strings irrespective of the platform that runs the pipeline.

We wanted to verify a PR body’s contents and therefore we used a multi-line grep. Despite it working on every single UNIX-based platform we could think of, it always failed on GitHub Actions. Turns out, GitHub appears to store at least github.event.pull_request.body in CRLF when a PR is edited on the website directly, so a regular expression using plain \n did not manage to find the string – only \r\n worked.

At first we thought the issue was our template, however the original template was written on a Unix machine and a hexdump shows that it only uses LF (i.e. ASCII 0a) for newlines. This was a major blocker for us as our development platform, our CI pipeline and our machines are all either Linux or macOS. We even tried to use cross-platform newline constructs and wrote an implementation in Python but it did not help matters as, of course, the platforms we used were all Unix-based and all of these constructs would return \n.

This behavior is not documented as far as I can tell and the behavior is universal irrespective of platform and its conventions. I have also not seen any other reports of this behavior, so I assume it is either a bug or an undocumented idiosyncrasy. Either way, the current implementation is quite unintuitive. In my opinion, either this needs to be documented clearly in the documentation or GitHub needs to do some kind of conversion when an event string is used in their Actions pipeline that use Unix-like operating systems.