peter-evans / create-or-update-comment

A GitHub action to create or update an issue or pull request comment
MIT License
685 stars 113 forks source link

How to create comment that from a txt file? #237

Closed seepine closed 1 year ago

seepine commented 1 year ago

like output.txt, it has multiple lines of text

actions ci auto build start...
install success
compile success
actions ci finish

I try, but failure

      - name: Generate QrCode
        id: log
        run: |
          echo "LOGS=$(cat output.txt)" >> $GITHUB_OUTPUT

      - name: Create or update comment
        uses: peter-evans/create-or-update-comment@v3
        with:
          issue-number: ${{ github.event.pull_request.number }}
          body: |
            Build success
            ${{ steps.log.outputs.LOGS }}
peter-evans commented 1 year ago

Hi @seepine

You can use the body-path input to specify the path to a comment body.

      - name: Create or update comment
        uses: peter-evans/create-or-update-comment@v3
        with:
          issue-number: ${{ github.event.pull_request.number }}
          body-path: output.txt