Skip to content

Commit

Permalink
Merge pull request #891 from googlefonts/packager-labels
Browse files Browse the repository at this point in the history
packager: add labels to prs
  • Loading branch information
m4rc1e authored Apr 2, 2024
2 parents e984a45 + 525c832 commit 2bf05db
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
6 changes: 6 additions & 0 deletions Lib/gftools/gfgithub.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,9 @@ def pr_files(self, pr_number: int, sleep=4):
# shouldn't hit any issues.
time.sleep(sleep)
return res

def add_labels(self, issue_number: int, labels: typing.List[str]):
return self._post(
self.rest_url(f"issues/{issue_number}/labels"),
{"labels": labels},
)
15 changes: 14 additions & 1 deletion Lib/gftools/packager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,12 @@
from gftools.scripts.add_font import main as add_font
from gftools.tags import GFTags
from gftools.util import google_fonts as fonts
from gftools.utils import download_file, is_google_fonts_repo, format_html
from gftools.utils import (
download_file,
is_google_fonts_repo,
format_html,
Google_Fonts_has_family,
)

log = logging.getLogger("gftools.packager")
LOG_FORMAT = "%(message)s"
Expand Down Expand Up @@ -422,6 +427,7 @@ def pr_family(
family_path: Path,
title: str,
body: str,
family_name: str,
base_repo: str = "google",
head_repo: str = "google",
):
Expand All @@ -436,6 +442,12 @@ def pr_family(
else:
resp = google_fonts.create_issue_comment(open_prs[0]["number"], "Updated")
log.info(f"Updated PR '{resp['html_url']}'")

# add labels to pr
if Google_Fonts_has_family(family_name):
google_fonts.create_issue_comment(open_prs[0]["number"], ["I Font Upgrade"])
else:
google_fonts.create_issue_comment(open_prs[0]["number"], ["I New Font"])
return True


Expand Down Expand Up @@ -551,6 +563,7 @@ def make_package(
family_path,
title,
msg,
metadata.name,
base_repo,
head_repo,
)
Expand Down

0 comments on commit 2bf05db

Please sign in to comment.