semantic-release / github

:octocat: semantic-release plugin to publish a GitHub release and comment on released Pull Requests/Issues
MIT License
402 stars 125 forks source link

Filter PR/Issue that should get a comment on success #359

Closed balazsorban44 closed 1 week ago

balazsorban44 commented 3 years ago

First I would like to describe my problem, and try to come with a suggestion: Originally posted at: https://github.com/semantic-release/semantic-release/issues/1603 ​ but posting here as it seems more fit:

so to get our prerelease (next) branch up-to-date, I did as you suggested, and merged our main/latest branch into it. Now semantic-release sent out a comment to ALL minor bugfix issues/PRs made to the main - those have already been closed and released - when it published a new next release :eyes:. Is it possible to avoid that somehow? Those changes have already been released, why semantic-release is so eager to comment/send out notifications on those again? :confused: It now generated over 100 comments on already closed/handled issues, and I have no idea why. :cry: Will those be re-released a third time now when I merge them back to main? :fearful: The repo in question: https://github.com/nextauthjs/next-auth Our config is fairly simple:

"release": {
​"branches": [
​"+([0-9])?(.{+([0-9]),x}).x",
​"main",
​{
​"name": "beta",
​"prerelease": true
​},
​{
​"name": "next",
​"prerelease": true
​}
​]
},

Is there any configuration that could prohibit semantic-release to dig up already closed/merged labeled/commented issues/PRs, and only comment/label those that haven't been done so before? :thinking:

If currently there is no way of achieving this, here is my suggestion:

I studied the following file:

https://github.com/semantic-release/github/blob/master/lib/success.js

And it would be nice to have an option to filter the issues/prs, before sending out a comment, something like this:

successFilter: (pr) => !pr.labels.some(label => label.name.includes("released"))

This should restrict the PRs to only those that don't have a label yet containing "released"

Ref: https://docs.github.com/en/rest/reference/search#search-issues-and-pull-requests

markov00 commented 2 years ago

Any update on this? It becomes really annoying in particular in some cases like the following https://github.com/elastic/elastic-charts/issues/1108#issuecomment-854838687 where we have dozen of successful release comments I saw the #360 PR I hope it can go through and be merged soon, if not we should probably just disable the successComment as a workaround Thanks

JonasSchubert commented 3 months ago

I have opened a PR in the gitlab project with a different approach, utilizing the lodash template. This is based on an idea by @fgreinacher. It allows to use the successComment without introducing further configuration and can by quiet powerful. Maybe it can be used in this project to, in case it will be approved for the gitlab plugin to keep the projects similar.

github-actions[bot] commented 1 week ago

:tada: This issue has been resolved in version 10.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: