Madrapps / jacoco-report

Github action that publishes the JaCoCo report as a comment in the Pull Request
https://github.com/marketplace/actions/jacoco-report
MIT License
144 stars 63 forks source link

github actions bot not creating any comments #70

Open frankwuyue opened 11 months ago

frankwuyue commented 11 months ago

I am running this action at debug mode and the log seems like everything is ok. but the github actions bot doesn't appear to comment on my pr. I am using a forked repo and created a pr to the forked repo, is that the problem? I think github actions' permissions are set to max privileges.

Event is push
passEmoji: :green_apple:
failEmoji: :x:
base sha: 9c991c2e99336d4b83b9a7c2e36ad3a766f9432a
head sha: a2ccfb03a73bc769fd5[17](xxxxx/actions/runs/439360/jobs/1151252#step:8:18)df31d41995ef9072961
....

Resolved files: ....
project: {
    "modules": [],
    "isMultiModule": true,
    "overall": {
        "covered": xxx,
        "missed": xxx,
        "percentage": xxx
    },
    "changed": {
        "covered": 0,
        "missed": 0,
        "percentage": null
    },
    "coverage-changed-files": 100
}
skip: false
prNumber: undefined
volodia-chornenkyy commented 10 months ago

Same story for me on a regular private repo.

Using these steps as a workaround:

      # region workaround for madrapps/jacoco-report
      # from https://github.com/marketplace/actions/delete-pr-review-comments
      - uses: aki77/delete-pr-comments-action@v1
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          bodyContains: |-
            [Coverage(%)]

      # from https://github.com/mshick/add-pr-comment
      - uses: mshick/add-pr-comment@v2
        with:
          repo-token: ${{ secrets.GITHUB_TOKEN }}
          message: |
            | Area  | Coverage(%) |
            | ------------- | ------------- |
            | **Overall**  | ${{(steps.jacoco.outputs.coverage-overall)}}  |
            | **Changed Files**  | ${{(steps.jacoco.outputs.coverage-changed-files)}}  |
          refresh-message-position: true
      # endregion
omatuschin commented 9 months ago

Notice the message "prNumber: undefined" in the debug output. The PR is unknown because the workflow was triggered by a push. Change the workflow trigger to "pull_request" instead and it will work.