danger-js icon indicating copy to clipboard operation
danger-js copied to clipboard

[Feature Request] Use Thread instead of comment

Open shyim opened this issue 3 years ago • 15 comments

Describe the bug Sometimes you want that people resolve the danger comment. Example on a fail message.

I would like a new command-line option that forces to create a thread instead of a comment.

What do you think about that @orta . I would also provide a PR

shyim avatar May 11 '21 13:05 shyim

Assuming you mean reviews for GitHub? I think this pattern from Danger Ruby can work: https://github.com/danger/danger-js/issues/1090#issuecomment-739487075

Personally, I'm not much a fan of the pattern because it means a lot of notifications but I can see folks wanting it

orta avatar May 11 '21 13:05 orta

Yea. But I would try to keep it simple like danger ci --use-thread

shyim avatar May 11 '21 13:05 shyim

I don't want a CLI flag for it, it's a DSL attribute because it differs per code review service

orta avatar May 11 '21 13:05 orta

So instead using warn/fail etc. Custom method like danger.github.createDiscussion() ? 🤔

shyim avatar May 11 '21 13:05 shyim

Hrm, maybe it should be a CLI param, we do that for checks. That would make life easy for downstream languages like swift/kotlin/python etc and doesn't change the JSON contract either.

I'm not sure on the name, because it's a 'review' in GitHub, a 'discussion' in GitLab and I'm sure bitbucket/azure have their own thing too. For now, let's say --use-thread but I might change that opinion in the future 👍🏻

orta avatar May 11 '21 14:05 orta

It would be great feature, in our case for Gitlab

punk-dev-robot avatar Oct 28 '21 13:10 punk-dev-robot

I think this feature is now implemented by #1176 for Github (there's no Commandline option, that's just how DangerJS now works). Do you want to do the same for Gitlab @kuba-gaj?

fbartho avatar Apr 08 '22 16:04 fbartho

@fbartho I would very much be in favor of danger comments being threads (rather than notes) for gitlab.

The reason being: In gitlab you can require all threads be resolved before merging an MR is allowed.

My team's usecase is when danger reports potentially dangerous errors. This should block the MR by default (a thread would effectively do this), but if the author/contributors are sure that the changes are safe, they can resolve the danger comment. Effectively, this is them acknowledging the potentially dangerous errors.

Honestly, it would be nice if notes/threads were both an option, but since danger with github defaults to threads, I would think gitlab should work the same.

dan-trewin avatar Apr 12 '22 20:04 dan-trewin

I have no stake in the gitlab platform, so I’m not going to say anything other that that your point does seem reasonable! Motivated contributors should feel free to make a clean PR to do this!

That said: each repository vendor has slightly different concepts, so I wouldn’t use GitHub to decide what to do on Gitlab. We want these platforms to feel natural for devs that only use a given provider.

fbartho avatar Apr 12 '22 21:04 fbartho

My team would also be very interested in this. We want our team members to acknowledge the result of danger.js, and Threads would be perfect for this.

erNail avatar Jul 06 '22 07:07 erNail

We also looking for such a implementation

olte-mms avatar Aug 29 '22 12:08 olte-mms

The feature would be a most welcome one

OtaconnSHGR avatar Aug 29 '22 12:08 OtaconnSHGR

This isn't the sort of OSS project where you can request features and the maintainers will build it for you, so +1s are not useful here. If you'd like to see it, I'd recommend you start looking at implementing it 👍🏻

orta avatar Aug 29 '22 12:08 orta

Does anyone know how to make Danger reply its own comment? This would create a thread in gitlab

beshur avatar Aug 31 '22 13:08 beshur

Looks like this is a way (full gist):

danger.gitlab.api.MergeRequestDiscussions.create(
          danger.gitlab.metadata.repoSlug,
          danger.gitlab.metadata.pullRequestID,
          "The new thread",
);

beshur avatar Sep 01 '22 10:09 beshur

I've started to implement this feature and it looks promising.

I've chosen an environment variable DANGER_GITLAB_USE_THREADS to enable it, so both are still supported and threads are opt-in.

I'll open a PR after some more testing.

uncaught avatar Oct 27 '22 14:10 uncaught

@orta This can be closed :)

uncaught avatar Nov 16 '22 07:11 uncaught

Thanks

orta avatar Nov 16 '22 08:11 orta