mirror of
https://github.com/konpa/devicon.git
synced 2025-08-12 17:44:24 +02:00
Update the check-bot
(#970)
* Add check for strokes in check-bot * Add check for svg file name * Update gulpfile to remove x and y of svg elem * Revert name changes to err file * check-bot now check devicon object as well * Fixed minor bugs * Improve logging in check_icon Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
25
.github/scripts/build_assets/arg_getters.py
vendored
25
.github/scripts/build_assets/arg_getters.py
vendored
@@ -34,28 +34,32 @@ def get_selenium_runner_args(peek_mode=False):
|
||||
action=PathResolverAction)
|
||||
|
||||
if peek_mode:
|
||||
parser.add_argument("--pr_title",
|
||||
parser.add_argument("pr_title",
|
||||
help="The title of the PR that we are peeking at")
|
||||
else:
|
||||
parser.add_argument("token",
|
||||
help="The GitHub token to access the GitHub REST API.",
|
||||
type=str)
|
||||
help="The GitHub token to access the GitHub REST API.")
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
def get_check_svgs_on_pr_args():
|
||||
def get_check_icon_pr_args():
|
||||
"""
|
||||
Get the commandline arguments for the check_svgs_on_pr.py.
|
||||
Get the commandline arguments for the check_icon_pr.py.
|
||||
"""
|
||||
parser = ArgumentParser(description="Check the SVGs to ensure their attributes are correct. Run whenever a PR is opened")
|
||||
parser.add_argument("files_added_json_path",
|
||||
help="The path to the files_added.json created by the gh-action-get-changed-files@2.1.4",
|
||||
|
||||
parser.add_argument("pr_title",
|
||||
help="The title of the PR that we are peeking at")
|
||||
|
||||
parser.add_argument("icons_folder_path",
|
||||
help="The path to the icons folder",
|
||||
action=PathResolverAction)
|
||||
|
||||
parser.add_argument("files_modified_json_path",
|
||||
help="The path to the files_modified.json created by the gh-action-get-changed-files@2.1.4",
|
||||
parser.add_argument("devicon_json_path",
|
||||
help="The path to the devicon.json",
|
||||
action=PathResolverAction)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
@@ -65,8 +69,7 @@ def get_release_message_args():
|
||||
"""
|
||||
parser = ArgumentParser(description="Create a text containing the icons and features added since last release.")
|
||||
parser.add_argument("token",
|
||||
help="The GitHub token to access the GitHub REST API.",
|
||||
type=str)
|
||||
help="The GitHub token to access the GitHub REST API.")
|
||||
return parser.parse_args()
|
||||
|
||||
|
||||
|
22
.github/scripts/build_assets/filehandler.py
vendored
22
.github/scripts/build_assets/filehandler.py
vendored
@@ -68,7 +68,7 @@ def get_svgs_paths(new_icons: List[dict], icons_folder_path: str,
|
||||
folder_path = Path(icons_folder_path, icon_info['name'])
|
||||
|
||||
if not folder_path.is_dir():
|
||||
raise ValueError(f"Invalid path. This is not a directory: {folder_path}.")
|
||||
raise ValueError(f"Invalid path. This is not a directory: '{folder_path}'.")
|
||||
|
||||
if icon_versions_only:
|
||||
get_icon_svgs_paths(folder_path, icon_info, file_paths, as_str)
|
||||
@@ -100,7 +100,7 @@ def get_icon_svgs_paths(folder_path: Path, icon_info: dict,
|
||||
if path.exists():
|
||||
file_paths.append(str(path) if as_str else path)
|
||||
else:
|
||||
raise ValueError(f"This path doesn't exist: {path}")
|
||||
raise ValueError(f"This path doesn't exist: '{path}'")
|
||||
|
||||
|
||||
def get_all_svgs_paths(folder_path: Path, icon_info: dict,
|
||||
@@ -119,7 +119,7 @@ def get_all_svgs_paths(folder_path: Path, icon_info: dict,
|
||||
if path.exists():
|
||||
file_paths.append(str(path) if as_str else path)
|
||||
else:
|
||||
raise ValueError(f"This path doesn't exist: {path}")
|
||||
raise ValueError(f"This path doesn't exist: '{path}'")
|
||||
|
||||
|
||||
def is_alias(font_version: str, aliases: List[dict]):
|
||||
@@ -207,6 +207,14 @@ def create_screenshot_folder(dir, screenshot_name: str="screenshots/"):
|
||||
finally:
|
||||
return str(screenshot_folder)
|
||||
|
||||
def write_to_file(path: str, value: any):
|
||||
"""
|
||||
Write the value to a file.
|
||||
"""
|
||||
with open(path, "w") as file:
|
||||
file.write(value)
|
||||
|
||||
# --- NOT USED CURRENTLY ---
|
||||
def get_added_modified_svgs(files_added_json_path: str,
|
||||
files_modified_json_path: str):
|
||||
"""
|
||||
@@ -230,11 +238,3 @@ def get_added_modified_svgs(files_added_json_path: str,
|
||||
svgs.append(path)
|
||||
|
||||
return svgs
|
||||
|
||||
|
||||
def write_to_file(path: str, value: any):
|
||||
"""
|
||||
Write the value to a file.
|
||||
"""
|
||||
with open(path, "w") as file:
|
||||
file.write(value)
|
||||
|
7
.github/scripts/build_assets/util.py
vendored
7
.github/scripts/build_assets/util.py
vendored
@@ -5,7 +5,6 @@ import platform
|
||||
import sys
|
||||
import traceback
|
||||
|
||||
|
||||
def exit_with_err(err: Exception):
|
||||
"""
|
||||
Exit the current step and display the err.
|
||||
@@ -66,3 +65,9 @@ def find_object_added_in_pr(icons: List[dict], pr_title: str):
|
||||
message = "util.find_object_added_in_pr: Couldn't find an icon matching the name in the PR title.\n" \
|
||||
f"PR title is: '{pr_title}'"
|
||||
raise Exception(message)
|
||||
|
||||
|
||||
valid_svg_filename_pattern = re.compile(r"-(original|plain|line)(-wordmark)?\.svg$")
|
||||
def is_svg_name_valid(filename: str):
|
||||
return valid_svg_filename_pattern.search(filename) is not None
|
||||
|
||||
|
Reference in New Issue
Block a user