-
Notifications
You must be signed in to change notification settings - Fork 37
feat: Don't allow the merging of PRs when they don't have a clean state [WIP] #454
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
base: main
Are you sure you want to change the base?
Conversation
|
Hi, @Gustrb! |
|
Hey @bncer should we maybe merge the OctocrabMergeableState::Blocked state as well? |
|
Yeah, definitely we can work together. As for MergeableState::Blocked octocrab uses enum what was provided from github api. I can only find API doc from GraphQL API. I think it should be included in merge conflict state. |
|
@Gustrb I set up local environment by hard coding some required fields. |
|
Hi, thanks for the PR! :) I just wanted to note that I'm having a very busy week right now, and probably won't have time to take a look until next week. |
Kobzol
left a comment
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.
Thank you! Left some comments, but otherwise the PR looks great.
| return Ok(Some(approve_non_open_pr_comment())); | ||
| } | ||
|
|
||
| if matches!(pr.github.mergeable_state, MergeableState::Dirty) { |
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.
We do indeed treat both Dirty and Blocked as having conflicts. Could you please construct database::MergeableState from the GH state using its From impl, and then check if the resulting state is mergeable? To use the same logic everywhere. Thanks!
|
|
||
| pub fn approve_non_clean_pr() -> Comment { | ||
| Comment::new( | ||
| r":clipboard: Looks like this PR is not ready to be merged, ignoring approval.".to_string(), |
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.
| r":clipboard: Looks like this PR is not ready to be merged, ignoring approval.".to_string(), | |
| r":clipboard: This pull request has merge conflicts. These have to be resolved before the PR can be approved.".to_string(), |
| self.status = PullRequestStatus::Draft; | ||
| } | ||
|
|
||
| pub fn dirty_pull_request(&mut self) { |
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.
| pub fn dirty_pull_request(&mut self) { | |
| pub fn make_merge_conflict(&mut self) { |
I still have some stuff do do before marking it as "Ready to Review"
I am just starting with this so might take some time :) All advice is appreciated
Closes #452