Skip to content

Commit 8077d11

Browse files
committed
Backport create_status from v1.0.0
This fixes a ValidationError caused by defaults in the method :muscle: :computer: :us:
1 parent c076429 commit 8077d11

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

github3/repos/repo.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -786,20 +786,26 @@ def create_release(self, tag_name, target_commitish=None, name=None,
786786
return Release(json, self)
787787

788788
@requires_auth
789-
def create_status(self, sha, state, target_url='', description='', context=''):
789+
def create_status(self, sha, state, target_url=None, description=None,
790+
context='default'):
790791
"""Create a status object on a commit.
791792
792793
:param str sha: (required), SHA of the commit to create the status on
793794
:param str state: (required), state of the test; only the following
794795
are accepted: 'pending', 'success', 'error', 'failure'
795796
:param str target_url: (optional), URL to associate with this status.
796797
:param str description: (optional), short description of the status
798+
:param str context: (optional), A string label to differentiate this
799+
status from the status of other systems
800+
:returns: the status created if successful
801+
:rtype: :class:`~github3.repos.status.Status`
797802
"""
798-
json = {}
803+
json = None
799804
if sha and state:
800805
data = {'state': state, 'target_url': target_url,
801806
'description': description, 'context': context}
802807
url = self._build_url('statuses', sha, base_url=self._api)
808+
self._remove_none(data)
803809
json = self._json(self._post(url, data=data), 201)
804810
return Status(json) if json else None
805811

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy