From adb5d57b6b4927b1c61c4e63dccd8f9366b601be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Thu, 7 Jul 2022 20:33:41 +0200 Subject: [PATCH 01/12] Remove unused import --- tests/test_filepaths.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_filepaths.py b/tests/test_filepaths.py index c77c8f28..485b1bf3 100644 --- a/tests/test_filepaths.py +++ b/tests/test_filepaths.py @@ -2,7 +2,7 @@ from gidgethub import sansio -from bedevere import news, filepaths +from bedevere import filepaths from bedevere.prtype import Category From c1cc5891492b0cb2417312c6a7fa8f0226a0b1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Thu, 7 Jul 2022 20:33:52 +0200 Subject: [PATCH 02/12] Refactor ``Category`` to be ``Labels`` --- bedevere/prtype.py | 10 +++++----- tests/test_filepaths.py | 10 +++++----- tests/test_prtype.py | 12 ++++++------ 3 files changed, 16 insertions(+), 16 deletions(-) diff --git a/bedevere/prtype.py b/bedevere/prtype.py index 893e0960..c6acf784 100644 --- a/bedevere/prtype.py +++ b/bedevere/prtype.py @@ -8,8 +8,8 @@ @enum.unique -class Category(enum.Enum): - """Category of Pull Request.""" +class Labels(enum.Enum): + """Labels that can be applied to a Pull Request.""" type_bug = f"{TYPE_LABEL_PREFIX}-bug" documentation = "docs" @@ -19,7 +19,7 @@ class Category(enum.Enum): tests = "tests" -async def add_category(gh, issue, category): +async def add_label(gh, issue, category): """Apply this type label if there aren't any type labels on the PR.""" if any(label.startswith("type") for label in util.labels(issue)): return @@ -47,7 +47,7 @@ async def classify_by_filepaths(gh, pull_request, filenames): else: return if tests: - await add_category(gh, issue, Category.tests) + await add_label(gh, issue, Labels.tests) elif docs: - await add_category(gh, issue, Category.documentation) + await add_label(gh, issue, Labels.documentation) return diff --git a/tests/test_filepaths.py b/tests/test_filepaths.py index 485b1bf3..17e31d58 100644 --- a/tests/test_filepaths.py +++ b/tests/test_filepaths.py @@ -4,7 +4,7 @@ from bedevere import filepaths -from bedevere.prtype import Category +from bedevere.prtype import Labels from .test_news import check_n_pop_nonews_events @@ -88,7 +88,7 @@ async def test_docs_only(author_association): check_n_pop_nonews_events(gh, author_association == 'NONE') assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.documentation.value] + assert gh.post_data[0] == [Labels.documentation.value] @pytest.mark.parametrize('author_association', ['OWNER', 'MEMBER', 'CONTRIBUTOR', 'NONE']) @@ -117,7 +117,7 @@ async def test_tests_only(author_association): check_n_pop_nonews_events(gh, author_association == 'NONE') assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.tests.value] + assert gh.post_data[0] == [Labels.tests.value] async def test_docs_and_tests(): @@ -145,7 +145,7 @@ async def test_docs_and_tests(): assert gh.post_url[0] == 'https://api.github.com/some/status' assert gh.post_data[0]['state'] == 'success' assert gh.post_url[1] == 'https://api.github.com/some/label' - assert gh.post_data[1] == [Category.tests.value] + assert gh.post_data[1] == [Labels.tests.value] async def test_news_and_tests(): @@ -174,7 +174,7 @@ async def test_news_and_tests(): assert gh.post_url[0] == 'https://api.github.com/some/status' assert gh.post_data[0]['state'] == 'success' assert gh.post_url[1] == 'https://api.github.com/some/label' - assert gh.post_data[1] == [Category.tests.value] + assert gh.post_data[1] == [Labels.tests.value] async def test_synchronize(): diff --git a/tests/test_prtype.py b/tests/test_prtype.py index 3e274e81..d4d778bc 100644 --- a/tests/test_prtype.py +++ b/tests/test_prtype.py @@ -1,5 +1,5 @@ from bedevere import prtype -from bedevere.prtype import Category +from bedevere.prtype import Labels class FakeGH: @@ -85,7 +85,7 @@ async def test_docs_no_news(): assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.documentation.value] + assert gh.post_data[0] == [Labels.documentation.value] async def test_docs_and_news(): @@ -106,7 +106,7 @@ async def test_docs_and_news(): assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.documentation.value] + assert gh.post_data[0] == [Labels.documentation.value] async def test_tests_only(): @@ -127,7 +127,7 @@ async def test_tests_only(): assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.tests.value] + assert gh.post_data[0] == [Labels.tests.value] async def test_docs_and_tests(): @@ -149,7 +149,7 @@ async def test_docs_and_tests(): # Only creates type-tests label. assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.tests.value] + assert gh.post_data[0] == [Labels.tests.value] async def test_leave_existing_type_labels(): @@ -191,7 +191,7 @@ async def test_news_and_tests(): # Creates type-tests label. assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Category.tests.value] + assert gh.post_data[0] == [Labels.tests.value] async def test_other_files(): From 48063eea822f259feeb84cce7a8f667261adaf81 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:06:58 +0200 Subject: [PATCH 03/12] Rename from ``documentation`` to ``docs`` --- bedevere/prtype.py | 4 ++-- tests/test_filepaths.py | 2 +- tests/test_prtype.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/bedevere/prtype.py b/bedevere/prtype.py index c6acf784..0b97f346 100644 --- a/bedevere/prtype.py +++ b/bedevere/prtype.py @@ -12,7 +12,7 @@ class Labels(enum.Enum): """Labels that can be applied to a Pull Request.""" type_bug = f"{TYPE_LABEL_PREFIX}-bug" - documentation = "docs" + docs = "docs" type_feature = f"{TYPE_LABEL_PREFIX}-feature" performance = "performance" type_security = f"{TYPE_LABEL_PREFIX}-security" @@ -49,5 +49,5 @@ async def classify_by_filepaths(gh, pull_request, filenames): if tests: await add_label(gh, issue, Labels.tests) elif docs: - await add_label(gh, issue, Labels.documentation) + await add_label(gh, issue, Labels.docs) return diff --git a/tests/test_filepaths.py b/tests/test_filepaths.py index 17e31d58..1fbd3380 100644 --- a/tests/test_filepaths.py +++ b/tests/test_filepaths.py @@ -88,7 +88,7 @@ async def test_docs_only(author_association): check_n_pop_nonews_events(gh, author_association == 'NONE') assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Labels.documentation.value] + assert gh.post_data[0] == [Labels.docs.value] @pytest.mark.parametrize('author_association', ['OWNER', 'MEMBER', 'CONTRIBUTOR', 'NONE']) diff --git a/tests/test_prtype.py b/tests/test_prtype.py index d4d778bc..d51bcdea 100644 --- a/tests/test_prtype.py +++ b/tests/test_prtype.py @@ -62,7 +62,7 @@ async def test_news_only(): } await prtype.classify_by_filepaths(gh, event_data['pull_request'], filenames) assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' - # News only .rst does not add a type-documentation label. + # News only .rst does not add a type-docs label. assert len(gh.post_url) == 0 assert len(gh.post_data) == 0 @@ -85,7 +85,7 @@ async def test_docs_no_news(): assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Labels.documentation.value] + assert gh.post_data[0] == [Labels.docs.value] async def test_docs_and_news(): @@ -106,7 +106,7 @@ async def test_docs_and_news(): assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Labels.documentation.value] + assert gh.post_data[0] == [Labels.docs.value] async def test_tests_only(): From 8109b9a66dbf5f789941783644a2bd699aa525af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:07:23 +0200 Subject: [PATCH 04/12] Rename label --- bedevere/prtype.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bedevere/prtype.py b/bedevere/prtype.py index 0b97f346..8f1f333d 100644 --- a/bedevere/prtype.py +++ b/bedevere/prtype.py @@ -19,11 +19,11 @@ class Labels(enum.Enum): tests = "tests" -async def add_label(gh, issue, category): +async def add_label(gh, issue, label): """Apply this type label if there aren't any type labels on the PR.""" if any(label.startswith("type") for label in util.labels(issue)): return - await gh.post(issue["labels_url"], data=[category.value]) + await gh.post(issue["labels_url"], data=[label.value]) async def classify_by_filepaths(gh, pull_request, filenames): From 4ea7afb63a7fd6b5b35fcd646e9a3ba6e9a5e546 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:19:55 +0200 Subject: [PATCH 05/12] Update comment --- tests/test_prtype.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_prtype.py b/tests/test_prtype.py index d51bcdea..541a1d68 100644 --- a/tests/test_prtype.py +++ b/tests/test_prtype.py @@ -62,7 +62,7 @@ async def test_news_only(): } await prtype.classify_by_filepaths(gh, event_data['pull_request'], filenames) assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' - # News only .rst does not add a type-docs label. + # News only .rst does not add a docs label. assert len(gh.post_url) == 0 assert len(gh.post_data) == 0 From 01533186057c0e8ce67adb0c30dadd1d51598cb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Fri, 8 Jul 2022 01:18:20 +0200 Subject: [PATCH 06/12] Auto add the ``skip news`` label to ``docs`` PRs Co-authored-by: Ezio Melotti --- bedevere/prtype.py | 17 +++++++++++------ tests/test_filepaths.py | 2 +- tests/test_prtype.py | 2 +- 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/bedevere/prtype.py b/bedevere/prtype.py index 8f1f333d..ed94b69d 100644 --- a/bedevere/prtype.py +++ b/bedevere/prtype.py @@ -17,13 +17,15 @@ class Labels(enum.Enum): performance = "performance" type_security = f"{TYPE_LABEL_PREFIX}-security" tests = "tests" + skip_news = "skip news" -async def add_label(gh, issue, label): +async def add_label(gh, issue, labels): """Apply this type label if there aren't any type labels on the PR.""" if any(label.startswith("type") for label in util.labels(issue)): return - await gh.post(issue["labels_url"], data=[label.value]) + label_names = [c.value for c in labels] + await gh.post(issue["labels_url"], data=label_names) async def classify_by_filepaths(gh, pull_request, filenames): @@ -35,10 +37,10 @@ async def classify_by_filepaths(gh, pull_request, filenames): The routing is handled by the filepaths module. """ issue = await util.issue_for_PR(gh, pull_request) - docs = tests = False + news = docs = tests = False for filename in filenames: if util.is_news_dir(filename): - continue + news = True filepath = pathlib.PurePath(filename) if filepath.suffix == '.rst': docs = True @@ -47,7 +49,10 @@ async def classify_by_filepaths(gh, pull_request, filenames): else: return if tests: - await add_label(gh, issue, Labels.tests) + await add_label(gh, issue, [Labels.tests]) elif docs: - await add_label(gh, issue, Labels.docs) + if news: + await add_label(gh, issue, [Labels.docs]) + else: + await add_label(gh, issue, [Labels.docs, Labels.skip_news]) return diff --git a/tests/test_filepaths.py b/tests/test_filepaths.py index 1fbd3380..932b3767 100644 --- a/tests/test_filepaths.py +++ b/tests/test_filepaths.py @@ -88,7 +88,7 @@ async def test_docs_only(author_association): check_n_pop_nonews_events(gh, author_association == 'NONE') assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Labels.docs.value] + assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value] @pytest.mark.parametrize('author_association', ['OWNER', 'MEMBER', 'CONTRIBUTOR', 'NONE']) diff --git a/tests/test_prtype.py b/tests/test_prtype.py index 541a1d68..f39c33cf 100644 --- a/tests/test_prtype.py +++ b/tests/test_prtype.py @@ -85,7 +85,7 @@ async def test_docs_no_news(): assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' assert len(gh.post_url) == 1 assert gh.post_url[0] == 'https://api.github.com/some/label' - assert gh.post_data[0] == [Labels.docs.value] + assert gh.post_data[0] == [Labels.docs.value, Labels.skip_news.value] async def test_docs_and_news(): From b737f72c61a341f7db40de306120eb1bb621bec5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Mon, 11 Jul 2022 18:51:51 +0200 Subject: [PATCH 07/12] Apply suggestions from code review Co-authored-by: Ezio Melotti --- bedevere/prtype.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/bedevere/prtype.py b/bedevere/prtype.py index ed94b69d..5c520fb9 100644 --- a/bedevere/prtype.py +++ b/bedevere/prtype.py @@ -20,12 +20,12 @@ class Labels(enum.Enum): skip_news = "skip news" -async def add_label(gh, issue, labels): - """Apply this type label if there aren't any type labels on the PR.""" - if any(label.startswith("type") for label in util.labels(issue)): - return - label_names = [c.value for c in labels] - await gh.post(issue["labels_url"], data=label_names) +async def add_labels(gh, issue, labels): + """Add the specified labels to the PR.""" + current_labels = util.labels(issue) + label_names = [c.value for c in labels if c.value not in current_labels] + if label_names: + await gh.post(issue["labels_url"], data=label_names) async def classify_by_filepaths(gh, pull_request, filenames): @@ -49,10 +49,10 @@ async def classify_by_filepaths(gh, pull_request, filenames): else: return if tests: - await add_label(gh, issue, [Labels.tests]) + await add_labels(gh, issue, [Labels.tests]) elif docs: if news: - await add_label(gh, issue, [Labels.docs]) + await add_labels(gh, issue, [Labels.docs]) else: - await add_label(gh, issue, [Labels.docs, Labels.skip_news]) + await add_labels(gh, issue, [Labels.docs, Labels.skip_news]) return From a0f850bcc8235ca55554109b8b34cd137803d30c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Mon, 11 Jul 2022 18:55:18 +0200 Subject: [PATCH 08/12] Fix test --- tests/test_prtype.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tests/test_prtype.py b/tests/test_prtype.py index f39c33cf..68174342 100644 --- a/tests/test_prtype.py +++ b/tests/test_prtype.py @@ -169,7 +169,10 @@ async def test_leave_existing_type_labels(): await prtype.classify_by_filepaths(gh, event_data['pull_request'], filenames) assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' # Only creates type-tests label. - assert len(gh.post_url) == 0 + assert len(gh.post_url) == 1 + assert gh.post_url[0] == "https://api.github.com/some/label" + assert gh.post_data[0] == [Labels.tests.value] + async def test_news_and_tests(): From 9fc4cef7ec0d671e897bf994e4cea55de7e013db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Mon, 11 Jul 2022 22:35:08 +0200 Subject: [PATCH 09/12] Update tests and coverage --- bedevere/util.py | 13 ++++++++++--- tests/test_prtype.py | 23 +++++++++++++++++++++-- 2 files changed, 31 insertions(+), 5 deletions(-) diff --git a/bedevere/util.py b/bedevere/util.py index 04a400a2..1a873985 100644 --- a/bedevere/util.py +++ b/bedevere/util.py @@ -4,7 +4,6 @@ import gidgethub - DEFAULT_BODY = "" TAG_NAME = "gh-issue-number" NEWS_NEXT_DIR = "Misc/NEWS.d/next/" @@ -88,7 +87,11 @@ async def files_for_PR(gh, pull_request): async def issue_for_PR(gh, pull_request): - """Get the issue data for a pull request.""" + """Get the issue_url for a pull request. + + The issue_url is the API endpoint for the given pull_request. + This terminology follows the official Github API and its documentation. + """ return await gh.getitem(pull_request["issue_url"]) @@ -106,7 +109,11 @@ async def patch_body(gh, pull_request, issue_number): if not re.search(rf"(^|\b)(GH-|gh-|#){issue_number}\b", pull_request["body"]): return await gh.patch( pull_request["url"], - data={"body": BODY.format(body=pull_request["body"], issue_number=issue_number)}, + data={ + "body": BODY.format( + body=pull_request["body"], issue_number=issue_number + ) + }, ) return diff --git a/tests/test_prtype.py b/tests/test_prtype.py index 68174342..00a5ec5f 100644 --- a/tests/test_prtype.py +++ b/tests/test_prtype.py @@ -154,7 +154,7 @@ async def test_docs_and_tests(): async def test_leave_existing_type_labels(): filenames = {'/path/to/docs.rst', 'test_docs2.py'} - issue = {'labels': [{'name': 'skip news'}, {'name': 'type-documentation'}], + issue = {'labels': [{'name': 'skip news'}, {'name': 'docs'}], 'labels_url': 'https://api.github.com/some/label'} gh = FakeGH(getiter=filenames, getitem=issue) event_data = { @@ -168,12 +168,31 @@ async def test_leave_existing_type_labels(): } await prtype.classify_by_filepaths(gh, event_data['pull_request'], filenames) assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' - # Only creates type-tests label. assert len(gh.post_url) == 1 assert gh.post_url[0] == "https://api.github.com/some/label" + # This should only add the tests label as the docs label is already applied assert gh.post_data[0] == [Labels.tests.value] +async def test_do_not_post_if_nothing_to_apply(): + filenames = {'/path/to/docs.rst'} + issue = {'labels': [{'name': 'skip news'}, {'name': 'docs'}], + 'labels_url': 'https://api.github.com/some/label'} + gh = FakeGH(getiter=filenames, getitem=issue) + event_data = { + 'action': 'opened', + 'number': 1234, + 'pull_request': { + 'url': 'https://api.github.com/repos/cpython/python/pulls/1234', + 'statuses_url': 'https://api.github.com/some/status', + 'issue_url': 'https://api.github.com/repos/cpython/python/issue/1234', + }, + } + await prtype.classify_by_filepaths(gh, event_data['pull_request'], filenames) + assert gh.getitem_url == 'https://api.github.com/repos/cpython/python/issue/1234' + # This should not post anything as docs is already applied + assert len(gh.post_url) == 0 + async def test_news_and_tests(): filenames = {'test_docs2.py', f'Misc/NEWS.d/next/Lib/{GOOD_BASENAME}'} From 2138a6f334091a8293c169f4ca6625b64801dade Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Mon, 11 Jul 2022 22:37:16 +0200 Subject: [PATCH 10/12] Remove auto-formatting by black --- bedevere/util.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bedevere/util.py b/bedevere/util.py index 1a873985..f2dd5e72 100644 --- a/bedevere/util.py +++ b/bedevere/util.py @@ -4,6 +4,7 @@ import gidgethub + DEFAULT_BODY = "" TAG_NAME = "gh-issue-number" NEWS_NEXT_DIR = "Misc/NEWS.d/next/" From b40e703cc4e6bf6e6429d6a8c544c617aff9eb66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Tue, 12 Jul 2022 00:39:35 +0200 Subject: [PATCH 11/12] Update bedevere/util.py --- bedevere/util.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/bedevere/util.py b/bedevere/util.py index f2dd5e72..c3ddfcaf 100644 --- a/bedevere/util.py +++ b/bedevere/util.py @@ -110,11 +110,7 @@ async def patch_body(gh, pull_request, issue_number): if not re.search(rf"(^|\b)(GH-|gh-|#){issue_number}\b", pull_request["body"]): return await gh.patch( pull_request["url"], - data={ - "body": BODY.format( - body=pull_request["body"], issue_number=issue_number - ) - }, + data={"body": BODY.format(body=pull_request["body"], issue_number=issue_number)}, ) return From 1e26aaa1621f6ac42825c57638d1331e907fa0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20van=20Noord?= <13665637+DanielNoord@users.noreply.github.com> Date: Tue, 12 Jul 2022 07:59:59 +0200 Subject: [PATCH 12/12] Update bedevere/util.py Co-authored-by: Ezio Melotti --- bedevere/util.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bedevere/util.py b/bedevere/util.py index c3ddfcaf..88b6f567 100644 --- a/bedevere/util.py +++ b/bedevere/util.py @@ -88,11 +88,8 @@ async def files_for_PR(gh, pull_request): async def issue_for_PR(gh, pull_request): - """Get the issue_url for a pull request. - - The issue_url is the API endpoint for the given pull_request. - This terminology follows the official Github API and its documentation. - """ + """Return a dict with data about the given PR.""" + # "issue_url" is the API endpoint for the given pull_request (despite the name) return await gh.getitem(pull_request["issue_url"])