actions-comment-pull-request icon indicating copy to clipboard operation
actions-comment-pull-request copied to clipboard

filePath content as code

Open darren-rose opened this issue 2 years ago • 1 comments

when using filePath I would like the rendered file to be shown as code e.g. a yaml file shown as yaml in a code block

darren-rose avatar Nov 16 '23 14:11 darren-rose

I was able to add some formatting by editing the file contents before commenting it. I added another step before the comment step:

...
  - name: overwrite parts of the comment file
          env:
            FILE_PATH: ${{ path_to_file }}
          run: |
            echo "\`\`\`js" > tmp
            cat $FILE_PATH >> tmp
            echo "\`\`\`" >> tmp
            mv tmp $FILE_PATH

 - name: Comment PR
      uses: thollander/actions-comment-pull-request@v2
      with:
        filePath: ${{ path_to_file }}
        comment_tag: pr_comment
...

After this, the message sent was in js format.

mindler-olli avatar Dec 13 '23 08:12 mindler-olli