The Wayback Machine - https://web.archive.org/web/20201027175044/https://github.com/cli/cli/issues/1190
Skip to content
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

Limit merge methods to merge button settings #1190

Open
dirn opened this issue Jun 12, 2020 · 4 comments
Open

Limit merge methods to merge button settings #1190

dirn opened this issue Jun 12, 2020 · 4 comments

Comments

@dirn
Copy link

@dirn dirn commented Jun 12, 2020

Describe the feature or problem you’d like to solve

The settings for a project allow the merge methods associated with the Merge button to be limited to a subset of the three options

  • Allow merge commits
  • Allow squash merging
  • Allow rebase merging

When merging through gh pr merge, you are presented with a list of all three options regardless.

Proposed solution

It would be nice if the options were limited to only the ones supported by the project. To take it one step further, if only one of the options is supported, the question should be skipped entirely.

@dirn dirn added the enhancement label Jun 12, 2020
@vilmibm vilmibm added bug p3 and removed enhancement labels Oct 7, 2020
@vilmibm
Copy link
Member

@vilmibm vilmibm commented Oct 7, 2020

Switching to bug since we ought to be respecting that setting.

@mislav
Copy link
Member

@mislav mislav commented Oct 16, 2020

I'm guessing we should be querying something like this:

{
  repository(owner:"cli",name:"cli") {
    mergeCommitAllowed
    squashMergeAllowed
    rebaseMergeAllowed
  }
}

and adjusting the available options accordingly in

func prInteractiveMerge(deleteLocalBranch bool, crossRepoPR bool) (api.PullRequestMergeMethod, bool, error) {
mergeMethodQuestion := &survey.Question{
Name: "mergeMethod",
Prompt: &survey.Select{
Message: "What merge method would you like to use?",
Options: []string{"Create a merge commit", "Rebase and merge", "Squash and merge"},
Default: "Create a merge commit",
},
}
@divbhasin
Copy link

@divbhasin divbhasin commented Oct 17, 2020

New contributor here 👋 Willing to give this a shot :)

@divbhasin
Copy link

@divbhasin divbhasin commented Oct 17, 2020

Is it possible for a repo to have none of the 3 options enabled? The test for interactive merge fails because the "blueberries" repo we create to test on has none of the options enabled. Just wondering if this can also be a real world case so I can modify the tests accordingly.

EDIT: I have created the draft PR and mentioned my problem with the tests. Please take a look and advise on how to fix the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
4 participants
You can’t perform that action at this time.