gitlab icon indicating copy to clipboard operation
gitlab copied to clipboard

Feat(Comment): Add new parameters commentSuccessTo

Open Hakihiro opened this issue 1 year ago • 4 comments

Choose between MR or Issue message to be posted. Both is also allowed

Close: https://github.com/semantic-release/gitlab/issues/636

Hakihiro avatar Feb 13 '24 22:02 Hakihiro

Thanks for the PR @Hakihiro, greatly appreciated!

As mentioned in https://github.com/semantic-release/gitlab/issues/480#issuecomment-1446450041 I would prefer to solve this without a new configuration option.

Otherwise we might end with many similar options like commentSuccessForBranches, commentSuccessForStableVersions and in the worst case we'd need combinations of them 😬

fgreinacher avatar Feb 19 '24 08:02 fgreinacher

Thanks for the PR @Hakihiro, greatly appreciated!

As mentioned in #480 (comment) I would prefer to solve this without a new configuration option.

Otherwise we might end with many similar options like commentSuccessForBranches, commentSuccessForStableVersions and in the worst case we'd need combinations of them 😬

Hi @Hakihiro and thanks a lot for your contribution. I agree with @fgreinacher the risk of configuration overhead is too big and trying a templating attempt might be more sustainable.

JonasSchubert avatar Feb 19 '24 13:02 JonasSchubert

I understand your point of view. I'm not a big fan to put an information inside a template message to determine on which target(s) it should be posted. But I understand your fear about the unsustainable configuration becoming quickly unmainteable.

I will try to extract this information from the successMessage with lodash template, base on the following syntax: [to issues] - [to merge-request] - [to issues,merge-request]

Is this something more suitable for you?

Thanks for your feedback

Hakihiro avatar Feb 19 '24 14:02 Hakihiro

Thanks a ton!

I will try to extract this information from the successMessage with lodash template, base on the following syntax: [to issues] - [to merge-request] - [to issues,merge-request]

That's not even needed. The idea would be to not create the note if the rendered template returns a falsey value:

https://github.com/semantic-release/gitlab/blob/master/lib/success.js#L31-L38

Users could then define a template like this to indicate that they only want comments on issues (not sure about the exact syntax, needs some experimentation with the lodash template engine:

<% if (issue) { %> regular comment <% } %>

fgreinacher avatar Feb 19 '24 15:02 fgreinacher

Hi @Hakihiro and sorry already as I cross you a bit with another pull request. There was no activity here for some time now, so I created a new PR with these suggestions.

JonasSchubert avatar Jun 02 '24 14:06 JonasSchubert

Closing in favor of #730.

fgreinacher avatar Jun 05 '24 05:06 fgreinacher