Long issue bodies in shell script

I’m trying to create a workflow that parses raw logs (from a particular project) posted in issues, convert them to a HTML representation with a python script I’ve written and post a link back to the issue to that file. At this point, I have something that works but with a few limitations.

If a try to store the content body as an environment variable like this:

...
    steps:
    - name: Generate HTML output
      id: genout
      env:
        COMMENT_BODY: ${{ toJson(github.event.comment.body) }}
      run: 
        ...

I will get the infamous Argument list too long if the body is too large as it exceeds the environment variable maximum size. Unfortunately that is common as logs can be rather large. It works as expected for small logs however.

Trying to stuff ${{ toJson(github.event.comment.body) }} into run to circumvent that problem creates other problems as characters are interpreted by the shell, so backquotes and things like that can throw errors if they mismatch. Not good.

What I would prefer is a way to store the issue body in a file directly, so I can read the content from there. Is that possible somehow (without going via shell)?

The full contents are already on disk. If you look at Context and expression syntax for GitHub Actions - GitHub Docs github.event_path is the location of a .json file that contains the full webhook payload. You should be able to read that file in and parse from there.

Ah, that is excellent! That will definitely work for me, thanks for point that out!