Skip to content

Select commit email when merging PR #1450

Closed

Description

@vilhelmprytz

Describe the feature or problem you’d like to solve

When merging a PR on GitHub.com, I am able to select which email to use for the commit (if my account has several). I am not able to change this when merging using gh pr merge, instead, it uses the default email.

Proposed solution

An ability to select which email address to use for the merge commit like you can on the web interface. Perhaps as a flag? 🙂

Additional context

N/A

Activity

  1. added
    enhancement
    on Jul 29, 2020
  2. mislav commented on Aug 18, 2020

    @mislav
    Contributor

    Thank you for the feature request! What you are describing is currently not possible via the GitHub API, so it makes it less likely that we can implement this in a timely manner. In the meantime, I would suggesting merging locally instead, since it's likely you might be in a context of a local git repository.

  3. mislav commented on Feb 24, 2021

    @mislav
    Contributor

    Adding an idea by @mrolli: the value of git config user.email should be used as the default author email for the merge commit.

  4. added
    core
    on Mar 8, 2021
  5. ekans commented on May 4, 2021

    @ekans

    The value of git config user.name should be used as default author name also. This is the default behavior of git merge.

  6. added
    help wanted
    and removed
    core
    on Sep 3, 2021
  7. mislav commented on Sep 3, 2021

    @mislav
    Contributor

    Examples of other PRs that added extra fields to the mergePullRequest payload: #3344 #2980, in case someone wants to add the email field too!

  8. jtaylor100 commented on Feb 14, 2022

    @jtaylor100

    Wanted to implement this today, but it looks like the GitHub API still doesn't provide any kind of parameter for author emails and names (as mentioned in the comment above).

    See: https://docs.github.com/en/rest/reference/pulls#merge-a-pull-request

    Looks like this will remain unresolved until we see some changes from the GitHub REST API. This is closed source, so there's not much more to be done.

  9. mislav commented on Feb 16, 2022

    @mislav
    Contributor

    @jtaylor100 We use the GraphQL API for merging, which supports the AuthorEmail string parameter as input. For those wanting to submit a PR for this, you could add it here

    if payload.commitSubject != "" {
    commitHeadline := githubv4.String(payload.commitSubject)
    input.CommitHeadline = &commitHeadline
    }
    if payload.setCommitBody {
    commitBody := githubv4.String(payload.commitBody)
    input.CommitBody = &commitBody
    }

  10. jtaylor100 commented on Feb 20, 2022

    @jtaylor100

    @ekans In #5229 I wanted to also pass the user.name value as you suggest. However it seems that the GraphQL API only has a mutation field for authorEmail, none for something like authorName. So with the current GitHub GraphQL API version, passing the value of user.name is not currently possible.

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

    enhancementgood first issuehelp wanted

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions