-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle existing upgrade PRs #267
Conversation
@StefMa please take a look as well, if you can try this on your side that would be great as well 🙂 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes because ignoreClosedPullRequests
should be renamed to recreateClosedPullRequests
.
return; | ||
} | ||
PullRequestUtils utils = new PullRequestUtils(pullRequests(params)); | ||
if (utils.openPrExists(params.prBranch)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if I understand correctly, but will this branch ever reached? 🤔
We have the check above branchExist
.
If it exist -> return
Here we are asking for openPrExists
(for this branch name?)
If so, return
However, if that branchExist (because there is an openPr
), then we return already in Line 71?! 🤔
No?
It other words:
If there NO branch, then there is NO PR.
But if a branch exist (and maybe a PR), this will never be reached because we return early in Line 74.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the feedback, you're right: there should not be a case where a branch does not exist and an opened PR exists with the same branch, I forgot that GitHub closes the PR automatically in that case. I will fix this in a new PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import org.kohsuke.github.GHRepository; | ||
import org.kohsuke.github.GitHub; | ||
import org.kohsuke.github.GitHubBuilder; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess it makes finally sense to extract the GitHub API communcation behind an interface so we can test it easiliy 😇
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, tbh I'd rather have better e2e testing, we'll see what we do next.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Havent tested it yet, will do probably tomorrow mroning (UTC+1) 😅
One question about an if
branch that might not be reached.
Also a suggeston to move the Github API calls to an interface to abstract it away.
Right now it feels a bit messy to use it directly "everywhere"...
Also it makes testing a bit hard.
Otherwise looks good to me 🙃
Thanks for the addtitions.
Cant wait to have them 🚀
Oh.. and sorry for the review after merge 🙈
I didn't find the time until now..
Tested: First run:
Expected ✅ Second run:
I guess the output should be
Third run:
I guess the output should be
Because its not there?! 🤷 🤔 Fourth run:
Expected ✅ |
| `options.gitCommitExtraArgs` | List of additional git commit arguments | | ||
| `options.allowPreRelease` | Boolean: `true` will get the latest Maven/Gradle version even if it's a pre-release. Default is `false`. | | ||
| `options.labels` | Optional list of label (names) that will be added to the pull request. | | ||
| `options.recreateClosedPullRequests` | Boolean: `true` will recreate the pull request if a closed pull request with the same branch name exists. `false` will not recreate the pull request. Default is `false`. | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just stumbled over this while testing it.
Maybe we should remove the last s
.
Its just a single PR, right?
options.recreateClosedPullRequest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point, will rename it
That message would be misleading as the branch still exists and we should not do anything if the branch exists. I would stick with the current simple approach and message: existing branch = don't go further.
Not sure to understand the suggestion 🤔. As I see it: a PR exists and is closed, so we notified the user and no new PR is created. |
Fix #252
PRs can be recreated by setting
options.recreateClosedPullRequests
to true.Fix #211