github-pr-resource icon indicating copy to clipboard operation
github-pr-resource copied to clipboard

delete_previous_comments has no effect

Open vixus0 opened this issue 4 years ago • 4 comments

I'm passing delete_previous_comments: true in the parameters to my put step on this resource, along with comment: my comment. Check status is updated, the new comment gets added but the previous comments are not removed.

I'm using a GitHub app token with read & write permissions on pull requests. Is there anything I'm missing?

vixus0 avatar Dec 09 '20 10:12 vixus0

Hi,

Have you tried modifying the E2E test, that's available? Look at TestPutCommentsE2E and modify the underlying owner of the repo, to match one you're using and get back to us with the result.

rickardl avatar Jan 11 '21 13:01 rickardl

@rickardl I'll give that a try, thanks.

vixus0 avatar Jan 18 '21 10:01 vixus0

Hey 👋🏻

I had a similar issue, specifically:

  • My user was a GitHub Bot App
  • It didn't delete comments
  • Using OAuth on a personal account it did. The issue occurs here:

https://github.com/telia-oss/github-pr-resource/blob/9ec47e2d9f28d13a4738ff48f2f40d2a570b251a/github.go#L398

When evaluating, it comes out to:

+ if "githubApp" == "githubApp[bot]"
- if e.Node.Author.Login == getComments.Viewer.Login {

Specifically, getComments.Viewer.Login returns the name with [bot] but e.Node.Author.Login returns it without bot.

bee-san avatar Apr 15 '21 11:04 bee-san