swift
swift copied to clipboard
New Comment at each run
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
We just got those added to Danger JS, so Danger Swift could support them https://github.com/danger/danger-js/pull/1096
Yeah I think adding --newComment
should work, but in case a workaround might be having a different ID per run (a random generated one).
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.
Do you have danger js 10.6.0 installed? Because it seems to me that is something that should work also on bitbucket server
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] }
looks like the same issue here
I do get a new message for each run on the PR with juste Danger
as comment.
ok so to give more details, here is what the comment looks like:
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?
This happened to me as well on Github.
I use swift run danger-swift ci --newComment
and the result is:

For anyone looking at this I used the --id
as a workaround.
swift run danger-swift ci --id "foo"
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