Skip to content

Limit merge methods to merge button settings #1190

Closed

Description

@dirn

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.

Activity

  1. added
    enhancement
    on Jun 12, 2020
  2. added
    bug
    priority-3
    and removed
    enhancement
    on Oct 7, 2020
  3. vilmibm commented on Oct 7, 2020

    @vilmibm
    Contributor

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

  4. mislav commented on Oct 16, 2020

    @mislav
    Contributor

    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",
    },
    }

  5. divbhasin commented on Oct 17, 2020

    @divbhasin
    Contributor

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

  6. divbhasin commented on Oct 17, 2020

    @divbhasin
    Contributor

    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.

  7. added a commit that references this issue on Jan 22, 2021
  8. adonisj910 commented on Feb 2, 2021

    @adonisj910

    Code Scanning

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    buggood first issuehelp wantedpriority-3

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions