Skip to content

Commit f6ac195

Browse files
committed
Add repo dispatch event
1 parent 3b31f12 commit f6ac195

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/github3/repos/repo.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,23 @@ def create_tree(self, tree, base_tree=None):
13921392
json = self._json(self._post(url, data=data), 201)
13931393
return self._instance_or_null(git.Tree, json)
13941394

1395+
@decorators.requires_auth
1396+
def create_dispatch_event(self, event_type, client_payload=None):
1397+
"""Create a project for this repository.
1398+
1399+
:param str event_type:
1400+
(required), webhook event name
1401+
:param client_payload:
1402+
(optional), information about the webhook that may be used by the workflow
1403+
:returns:
1404+
True if successful, False otherwise
1405+
:rtype:
1406+
"""
1407+
url = self._build_url("dispatches", base_url=self._api)
1408+
data = {"event_type": event_type, "client_payload": client_payload}
1409+
self._remove_none(data)
1410+
return self._boolean(self._post(url, data=data), 204, 404)
1411+
13951412
@decorators.requires_auth
13961413
def delete(self):
13971414
"""Delete this repository.

0 commit comments

Comments
 (0)