swift icon indicating copy to clipboard operation
swift copied to clipboard

New Comment at each run

Open tibo opened this issue 4 years ago • 10 comments

Hi there!

Is there a way to make Danger add a new comment in a PR instead for each run of updating the existing one. there is a --new-comment options on Danger.ruby (https://danger.systems/guides/faq.html) but I haven't found anything related for Danger.swift.

Thanks

tibo avatar Jan 06 '21 14:01 tibo

We just got those added to Danger JS, so Danger Swift could support them https://github.com/danger/danger-js/pull/1096

orta avatar Jan 06 '21 16:01 orta

Yeah I think adding --newComment should work, but in case a workaround might be having a different ID per run (a random generated one).

f-meloni avatar Jan 06 '21 16:01 f-meloni

I tried --newComment but it didn't work either. In case it's relevant the PR is hosted on a bitbucket server I'm running the ci command with the --failOnErrors option.

tibo avatar Jan 06 '21 18:01 tibo

Do you have danger js 10.6.0 installed? Because it seems to me that is something that should work also on bitbucket server

f-meloni avatar Jan 07 '21 01:01 f-meloni

looks like the version installed via homebrew is outdated (10.1.0). I manage to get a 10.6.0 running from npm, but the options trigger a new error.

[2021-01-07T13:51:05.204Z] + danger-swift ci --failOnErrors --newComment
[2021-01-07T13:51:06.571Z] 
[2021-01-07T13:51:06.571Z] 
[2021-01-07T13:51:06.571Z] Found only messages, passing those to review.
[2021-01-07T13:51:06.571Z] Feedback: [object Object]
[2021-01-07T13:51:06.571Z] Request failed [400]: https://git.mycorp.com/rest/build-status/1.0/commits/58f9130f4a5d2a58878fd54084c366861f14460c
[2021-01-07T13:51:06.571Z] Response: {
[2021-01-07T13:51:06.571Z]   "errors": [
[2021-01-07T13:51:06.571Z]     {
[2021-01-07T13:51:06.571Z]       "context": null,
[2021-01-07T13:51:06.571Z]       "message": "Please specify a valid url",
[2021-01-07T13:51:06.571Z]       "exceptionName": null
[2021-01-07T13:51:06.571Z]     }
[2021-01-07T13:51:06.571Z]   ]
[2021-01-07T13:51:06.571Z] }

tibo avatar Jan 07 '21 14:01 tibo

looks like the same issue here

tibo avatar Jan 07 '21 14:01 tibo

I do get a new message for each run on the PR with juste Danger as comment.

tibo avatar Jan 07 '21 15:01 tibo

ok so to give more details, here is what the comment looks like: Screenshot 2021-01-11 at 15 09 49

and if I follow the url of the request returning the 400 error on my scm server, here is what I get:

{
  "size": 1,
  "limit": 25,
  "isLastPage": true,
  "values": [
    {
      "state": "SUCCESSFUL",
      "key": "393aa1ce45a2c5d576925e7bc835d688",
      "name": "Jenkins Folder -> Folder -> job -> branch PR-2301 -> run #XXX",
      "url": "http://jenkins.mycorp.com/job/folder/job/jobname/job/PR-2301/47/display/redirect",
      "description": "my commit",
      "dateAdded": 1610031875161
    }
  ],
  "start": 0
}

I might be wrong but this looks a lot like the the content of the "Builds" tab of the PR. maybe that's what Danger use to retrieve the previous comment or something?

tibo avatar Jan 11 '21 14:01 tibo

This happened to me as well on Github. I use swift run danger-swift ci --newComment and the result is:

CleanShot 2023-01-14 at 19 28 00@2x

For anyone looking at this I used the --id as a workaround. swift run danger-swift ci --id "foo"

Nikoloutsos avatar Jan 14 '23 17:01 Nikoloutsos

I used "danger-swift ci --failOnErrors --newComment" in my .yml file. I can able to see all the warnings and error messages in the PR overview. How to display only the error messages as a new comment not the warnings too

pavank30 avatar Dec 21 '23 10:12 pavank30