1
0
mirror of https://github.com/konpa/devicon.git synced 2025-08-22 22:24:43 +02:00

Build bot now build new SVGs in folder that were already built (#666)

* Refactor the pull request fetching code

* Refactor build script to use past PRs

* Added function to update icomoon json

* new icon: matlab (line) (#640)

* Add matlab-line

* Fixed issues reported by check svg bot

* optimisation for svg (#643)

Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>

* Add better logging to icomoon_build

Co-authored-by: Clemens Bastian <8781699+amacado@users.noreply.github.com>
Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
Thomas Bui
2021-06-13 06:17:13 -07:00
committed by GitHub
parent 8d617d7787
commit d60b334fa3
8 changed files with 248 additions and 116 deletions

View File

@@ -1,4 +1,6 @@
import os
import re
from typing import List
import platform
import sys
import traceback
@@ -41,4 +43,22 @@ def set_env_var(key: str, value: str, delimiter: str='~'):
else:
os.system(f'echo "{key}={value}" >> $GITHUB_ENV')
else:
raise Exception("This function doesn't support this platform: " + platform.system())
raise Exception("This function doesn't support this platform: " + platform.system())
def find_object_added_in_this_pr(icons: List[dict], pr_title: str):
"""
Find the icon name from the PR title.
:param icons, a list of the font objects found in the devicon.json.
:pr_title, the title of the PR that this workflow was called on.
:return a dictionary with the "name"
entry's value matching the name in the pr_title.
:raise If no object can be found, raise an Exception.
"""
try:
pattern = re.compile(r"(?<=^new icon: )\w+ (?=\(.+\))", re.I)
icon_name = pattern.findall(pr_title)[0].lower().strip() # should only have one match
icon = [icon for icon in icons if icon["name"] == icon_name][0]
return icon
except IndexError: # there are no match in the findall()
raise Exception("Couldn't find an icon matching the name in the PR title.")