semantic-release / gitlab

:fox_face: semantic-release plugin to publish a GitLab release
MIT License
269 stars 78 forks source link

Feat(Comment): Add new parameters commentSuccessTo #678

Closed Hakihiro closed 1 month ago

Hakihiro commented 4 months ago

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

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

fgreinacher commented 4 months ago

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 😬

JonasSchubert commented 4 months ago

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.

Hakihiro commented 4 months ago

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

fgreinacher commented 4 months ago

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 <% } %>
JonasSchubert commented 1 month ago

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.

fgreinacher commented 1 month ago

Closing in favor of #730.