8000 Build bot now check both the PRs and the `devicon.json` for icons to be build by Thomas-Boi · Pull Request #686 · devicons/devicon · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Build bot now check both the PRs and the devicon.json for icons to be build #686

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/scripts/build_assets/filehandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import re


def find_new_icons(devicon_json_path: str, icomoon_json_path: str):
def find_new_icons_in_devicon_json(devicon_json_path: str, icomoon_json_path: str):
"""
Find the newly added icons by finding the difference between
the devicon.json and the icomoon.json.
Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/build_assets/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def set_env_var(key: str, value: str, delimiter: str='~'):
raise Exception("This function doesn't support this platform: " + platform.system())


def find_object_added_in_this_pr(icons: List[dict], pr_title: str):
def find_object_added_in_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.
Expand Down
18 changes: 14 additions & 4 deletions .github/scripts/icomoon_build.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def main():
runner = None
try:
args = arg_getters.get_selenium_runner_args()
new_icons = get_icons_for_building(args.devicon_json_path, args.token)
new_icons = get_icons_for_building(args.icomoon_json_path, args.devicon_json_path, args.token)
if len(new_icons) == 0:
sys.exit("No files need to be uploaded. Ending script...")

Expand Down Expand Up @@ -54,21 +54,31 @@ def main():
runner.close()


def get_icons_for_building(devicon_json_path: str, token: str):
def get_icons_for_building(icomoon_json_path: str, devicon_json_path: str, token: str):
"""
Get the icons for building.
:param icomoon_json_path - the path to the `icomoon.json`.
:param devicon_json_path - the path to the `devicon.json`.
:param token - the token to access the GitHub API.
"""
all_icons = filehandler.get_json_file_content(devicon_json_path)
devicon_json = filehandler.get_json_file_content(devicon_json_path)
pull_reqs = api_handler.get_merged_pull_reqs_since_last_release(token)
new_icons = []

for pull_req in pull_reqs:
if api_handler.is_feature_icon(pull_req):
filtered_icon = util.find_object_added_in_this_pr(all_icons, pull_req["title"])
filtered_icon = util.find_object_added_in_pr(devicon_json, pull_req["title"])
if filtered_icon not in new_icons:
new_icons.append(filtered_icon)

# get any icons that might not have been found by the API
new_icons_from_devicon_json = filehandler.find_new_icons_in_devicon_json(
devicon_json_path, icomoon_json_path)

for icon in new_icons_from_devicon_json:
if icon not in new_icons:
new_icons.append(icon)

return new_icons


Expand Down
2 changes: 1 addition & 1 deletion .github/scripts/icomoon_peek.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def main():
new_icons = filehandler.get_json_file_content(args.devicon_json_path)

# get only the icon object that has the name matching the pr title
filtered_icon = util.find_object_added_in_this_pr(new_icons, args.pr_title)
filtered_icon = util.find_object_added_in_pr(new_icons, args.pr_title)
check_devicon_object(filtered_icon)
print("Icon being checked:", filtered_icon, sep = "\n", end='\n\n')

Expand Down
0