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

FIX: allow empty commitMessage for merging pulls #1447

Merged
merged 1 commit into from
Mar 1, 2020

Conversation

pratikmallya
Copy link
Contributor

@pratikmallya pratikmallya commented Mar 1, 2020

This change is specifically motivated by the desire to replicate
the same behavior as observed when merging PR's manually using
the "Squash and Merge" option. In that case, a commit message
including the title and commit message of all the commits in the
PR are included, and the squashed commit includes all of that
context.

I have tested that its possible to merge a Pull Request with
an empty commit message and verified that the api call replicates
the desired behavior:

curl -XPUT \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token $GITHUB_API_TOKEN" \
  -d '{"merge_method":"squash"}' \
  https://api.github.com/repos/pratikmallya/test/pulls/4/merge

{
  "sha": "08d173ee449e4ea505d8366b9fa416d6d3923f23",
  "merged": true,
  "message": "Pull Request successfully merged"
}

The merge commit: pratikmallya/test@08d173e
is exactly the behavior that I am seeking.

Fixes: #1448

This change is specifically motivated by the desire to replicate
the same behavior as observed when merging PR's manually using
the "Squash and Merge" option. In that case, a commit message
including the title and commit message of all the commits in the
PR are included, and the squashed commit includes all of that
context.

I have tested that its possible to merge a Pull Request with
an empty commit message and verified that the api call replicates
the desired behavior:

```
curl -XPUT \
  -H "Accept: application/vnd.github.v3+json" \
  -H "Authorization: token $GITHUB_API_TOKEN" \
  -d '{"merge_method":"squash"}' \
  https://api.github.com/repos/pratikmallya/test/pulls/4/merge

{
  "sha": "08d173ee449e4ea505d8366b9fa416d6d3923f23",
  "merged": true,
  "message": "Pull Request successfully merged"
}
```

The merge commit: pratikmallya/test@08d173e
is exactly the behavior that I am seeking.
@googlebot googlebot added the cla: yes Indication that the PR author has signed a Google Contributor License Agreement. label Mar 1, 2020
@pratikmallya pratikmallya marked this pull request as ready for review March 1, 2020 08:16
Copy link
Collaborator

@gmlewis gmlewis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @pratikmallya!
LGTM.
Merging.

@gmlewis gmlewis merged commit 82c570e into google:master Mar 1, 2020
@pratikmallya pratikmallya deleted the fix-merge branch March 1, 2020 20:45
n1lesh pushed a commit to n1lesh/go-github that referenced this pull request Oct 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes Indication that the PR author has signed a Google Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow merging PullRequests with commitMessage unspecified
3 participants