linuxdeepin / action-cppcheck

MIT License
4 stars 6 forks source link

Make the result comment optional #9

Closed ikerexxe closed 2 years ago

ikerexxe commented 2 years ago

I'm not an expert in GO so please review with care as I may have inadvertently made a very big mistake.

myml commented 2 years ago

What do you want to achieve? If you do not want to send the check result to commit, Should have skipped here https://github.com/linuxdeepin/action-cppcheck/blob/fab2b612ccb9f4c811086a5609e719a6bfb0558f/cmd/action-cppcheck/main.go#L126-L134

Maybe code -1 should be used to make the action fail?

ikerexxe commented 2 years ago

I'd like to remove only the check result, as an example: https://github.com/SSSD/sssd/pull/6089#pullrequestreview-927578085. I'd like to keep the errors themselves being published on the PR. I think that your proposal would also remove those. Am I right?

myml commented 2 years ago

Do you want to delete outdated comments or not send any comments? The Go Program is written for posting comments. if you do not need comment, can use the workflow

    steps:
      - uses: actions/checkout@v3
      - name: install
        run: sudo apt install -y cppcheck
      - name: run
        run: cppcheck --enable=all --error-exitcode=-1 ./ 1>/dev/null
ikerexxe commented 2 years ago

Do you want to delete outdated comments or not send any comments? The Go Program is written for posting comments. if you do not need comment, can use the workflow

    steps:
      - uses: actions/checkout@v3
      - name: install
        run: sudo apt install -y cppcheck
      - name: run
        run: cppcheck --enable=all --error-exitcode=-1 ./ 1>/dev/null

It's not clear for me that you are understanding what I'm trying to fix so I'd like to clarify it further.

This action posts two types of comments: the errors detected by cppcheck and the final result (Good or improvements are needed). I'd like the action to continue posting the errors detected by cppcheck, but I'd like to make the posting of the final result configurable. This way, I can configure it to disable the posting of the result for some workflows.

myml commented 2 years ago

https://github.com/myml/action-cppcheck/commit/25df296b56ec1345cbc19d66b733040a50bbe286 I modified the action.yam file to achieve it, it is what you want?

Test results here

ikerexxe commented 2 years ago

myml@25df296 I modified the action.yam file to achieve it, it is what you want?

No, but it's good that your provided the test results because it will enable me to explain myself correctly.

I don't want the tool to post the final result comment. But I want the tool to post the errors detected.

myml commented 2 years ago

I get it. This code is ok.

ikerexxe commented 2 years ago

Thank you for taking care of it!

myml commented 2 years ago

Hi @ikerexxe ! I forgot one thing. If comment_result is set to false and code checks out ok, then there is no need to call CreateReview agent. Unable to create a review without 'body' and 'comments'

ikerexxe commented 2 years ago

Unable to create a review without 'body' and 'comments'

Is this an error message from the action?

myml commented 2 years ago

See https://github.com/myml/test/pull/3

myml commented 2 years ago

Error from github api

2022/04/08 07:22:01 POST https://api.github.com/repos/myml/test/pulls/3/reviews: 422 Unprocessable Entity [{Resource: Field: Code: Message:You need to leave a comment indicating the requested changes.}]
ikerexxe commented 2 years ago

I've opened a new PR to fix this issue.