Skip to content

Commit 242a5eb

Browse files
support create dispatch event (#1201)
* Add repo dispatch event * fix comment * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * update python versions * fix long line * workaround doc8 1.1.2 bug --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 3b31f12 commit 242a5eb

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

.github/workflows/build.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ jobs:
88
strategy:
99
matrix:
1010
python:
11-
- { VERSION: "3.7", TOXENV: "py37", ALLOW_FAILURE: false }
12-
- { VERSION: "3.8", TOXENV: "py38", ALLOW_FAILURE: false }
1311
- { VERSION: "3.9", TOXENV: "py39", ALLOW_FAILURE: false }
1412
- { VERSION: "3.10", TOXENV: "py310", ALLOW_FAILURE: false }
1513
- { VERSION: "3.11", TOXENV: "py311", ALLOW_FAILURE: false }
14+
- { VERSION: "3.12", TOXENV: "py312", ALLOW_FAILURE: false }
15+
- { VERSION: "3.13", TOXENV: "py313", ALLOW_FAILURE: false }
1616
- {
17-
VERSION: "3.11",
17+
VERSION: "3.13",
1818
TOXENV: "flake8,doclint,docs,commitlint",
1919
ALLOW_FAILURE: false,
2020
}
21-
- { VERSION: "3.11", TOXENV: "docstrings", ALLOW_FAILURE: true }
21+
- { VERSION: "3.13", TOXENV: "docstrings", ALLOW_FAILURE: true }
2222
- { VERSION: "pypy3.9", TOXENV: "pypy", ALLOW_FAILURE: false }
2323

2424
steps:

src/github3/repos/repo.py

+18
Original file line numberDiff line numberDiff line change
@@ -1392,6 +1392,24 @@ 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 dispatch event 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
1403+
workflow
1404+
:returns:
1405+
True if successful, False otherwise
1406+
:rtype:
1407+
"""
1408+
url = self._build_url("dispatches", base_url=self._api)
1409+
data = {"event_type": event_type, "client_payload": client_payload}
1410+
self._remove_none(data)
1411+
return self._boolean(self._post(url, data=data), 204, 404)
1412+
13951413
@decorators.requires_auth
13961414
def delete(self):
13971415
"""Delete this repository.

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ commands =
8181
# rst-lint is really only valuable for non-Sphinx reStructuredText, see also:
8282
# https://github.com/twolfson/restructuredtext-lint/blob/65ce9d6c7768ef9135c1d3ee4a1ae8c7bf89d92f/README.rst#sphinx
8383
deps =
84-
doc8 >= 0.10.1
84+
doc8 >= 0.10.1, != 1.1.2
8585
proselint >= 0.13.0
8686
pygments
8787
restructuredtext_lint

0 commit comments

Comments
 (0)