From b86233aacd569eb7aadeb40049fd41e1b4734da9 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Fri, 11 Oct 2024 10:22:15 +0100 Subject: [PATCH 1/2] packager: update pr title when updating a pr --- Lib/gftools/gfgithub.py | 16 ++++++++++++++++ Lib/gftools/packager/__init__.py | 1 + 2 files changed, 17 insertions(+) diff --git a/Lib/gftools/gfgithub.py b/Lib/gftools/gfgithub.py index 80eba2fea..e551199ec 100644 --- a/Lib/gftools/gfgithub.py +++ b/Lib/gftools/gfgithub.py @@ -114,6 +114,22 @@ def create_pr( }, ) + def update_pr( + self, + pull_number: int, + title: str = None, + body: str = None, + state: str = None + ): + return self._post( + self.rest_url(f"pulls/{pull_number}"), + { + "title": title, + "body": body, + "state": state + } + ) + def create_issue_comment(self, issue_number: int, body: str): return self._post( self.rest_url(f"issues/{issue_number}/comments"), {"body": body} diff --git a/Lib/gftools/packager/__init__.py b/Lib/gftools/packager/__init__.py index 2a7d1d811..d571cc19b 100644 --- a/Lib/gftools/packager/__init__.py +++ b/Lib/gftools/packager/__init__.py @@ -558,6 +558,7 @@ def pr_family( google_fonts.add_labels(open_prs[0]["number"], ["I New Font"]) else: resp = google_fonts.create_issue_comment(open_prs[0]["number"], "Updated") + google_fonts.update_pr(open_prs[0]["number"], title=title) log.info(f"Updated PR '{resp['html_url']}'") # inherit labels from issue From 67418249fe1b9ef2d8fc374c78164cab1316a254 Mon Sep 17 00:00:00 2001 From: Marc Foley Date: Fri, 11 Oct 2024 10:28:25 +0100 Subject: [PATCH 2/2] black --- Lib/gftools/gfgithub.py | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) diff --git a/Lib/gftools/gfgithub.py b/Lib/gftools/gfgithub.py index e551199ec..433d5c84e 100644 --- a/Lib/gftools/gfgithub.py +++ b/Lib/gftools/gfgithub.py @@ -115,19 +115,11 @@ def create_pr( ) def update_pr( - self, - pull_number: int, - title: str = None, - body: str = None, - state: str = None + self, pull_number: int, title: str = None, body: str = None, state: str = None ): return self._post( self.rest_url(f"pulls/{pull_number}"), - { - "title": title, - "body": body, - "state": state - } + {"title": title, "body": body, "state": state}, ) def create_issue_comment(self, issue_number: int, body: str):