8000 Add sha parameter to Pull Request merge · kislyuk/github3.py@6ef02cb · GitHub
[go: up one dir, main page]

Skip to content

Commit 6ef02cb

Browse files
author
David Duke
committed
Add sha parameter to Pull Request merge
The Github v3 API supports an optional 'sha' parameter to explicitly specify the commit that should be at the head of a Pull Request when merging it. https://developer.github.com/v3/pulls/#merge-a-pull-request-merge-button Conflicts: github3/pulls.py
1 parent 96316e1 commit 6ef02cb

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

github3/pulls.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,18 @@ def iter_issue_comments(self, number=-1, etag=None):
300300
return self._iter(int(number), url, IssueComment, etag=etag)
301301

302302
@requires_auth
303-
def merge(self, commit_message=''):
303+
def merge(self, commit_message='', sha=None):
304304
"""Merge this pull request.
305305
306306
:param str commit_message: (optional), message to be used for the
307307
merge commit
308308
:returns: bool
309309
"""
310-
data = dumps({'commit_message': commit_message})
310+
parameters = {'commit_message': commit_message}
311+
if sha:
312+
parameters['sha'] = sha
311313
url = self._build_url('merge', base_url=self._api)
312-
json = self._json(self._put(url, data=data), 200)
314+
json = self._json(self._put(url, data=dumps(parameters)), 200)
313315
self.merge_commit_sha = json['sha']
314316
return json['merged']
315317

0 commit comments

Comments
 (0)
0