Skip to content

Commit 08aa325

Browse files
Feature: Peek and Build-Bot Upgrade (#806)
* Refactored peek script into a class * Post-peek workflow now upload the new screenshots * Refactored BuildSeleniumRunner into a class * Updated build_icons.yml to reflect new changes * Fixed issue with building icons that were already in the app * Build script will take screenshot of new icons * Update post peek yaml message * Added alerts * Peek script now check for strokes in icons * Updated post_peek's strokes in svgs message * Updated post_peek script's message * Updated post_peek's message * Refactored get_release_message into icomoon_build * Change devicon.css name to devicon-base.css * Updated post_peek message * Added update icon as a valid PR title for bot-peek * Add \n char to SVG after it gets optimized * Fixed error with 'update icon' regex * Build script now batch issues when upload SVG * Addressed build-bot's screenshot order * Apply suggestions from code review Co-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: David Leal <halfpacho@gmail.com>
1 parent e5aa8a9 commit 08aa325

17 files changed

+821
-407
lines changed

.github/scripts/build_assets/SeleniumRunner.py

Lines changed: 0 additions & 267 deletions
This file was deleted.

.github/scripts/build_assets/api_handler.py

Lines changed: 29 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,38 @@
22
import sys
33
import re
44

5+
6+
def get_merged_pull_reqs_since_last_release(token):
7+
"""
8+
Get all the merged pull requests since the last release.
9+
"""
10+
stopPattern = r"^(r|R)elease v"
11+
pull_reqs = []
12+
found_last_release = False
13+
page = 1
14+
15+
print("Getting PRs since last release.")
16+
while not found_last_release:
17+
data = get_merged_pull_reqs(token, page)
18+
# assume we don't encounter it during the loop
19+
last_release_index = 101
20+
21+
for i in range(len(data)):
22+
if re.search(stopPattern, data[i]["title"]):
23+
found_last_release = True
24+
last_release_index = i
25+
break
26+
pull_reqs.extend(data[:last_release_index])
27+
page += 1
28+
29+
# should contain all the PRs since last release
30+
return pull_reqs
31+
32+
533
def get_merged_pull_reqs(token, page):
634
"""
735
Get the merged pull requests based on page. There are
8-
100 results page. See https://docs.github.com/en/rest/reference/pulls
36+
100 results per page. See https://docs.github.com/en/rest/reference/pulls
937
for more details on the parameters.
1038
:param token, a GitHub API token.
1139
:param page, the page number.
@@ -71,30 +99,3 @@ def find_all_authors(pull_req_data, token):
7199
authors.add(commit["commit"]["author"]["name"])
72100
print(f"This URL didn't have an `author` attribute: {pull_req_data['commits_url']}")
73101
return ", ".join(["@" + author for author in list(authors)])
74-
75-
76-
def get_merged_pull_reqs_since_last_release(token):
77-
"""
78-
Get all the merged pull requests since the last release.
79-
"""
80-
stopPattern = r"^(r|R)elease v"
81-
pull_reqs = []
82-
found_last_release = False
83-
page = 1
84-
85-
print("Getting PRs since last release.")
86-
while not found_last_release:
87-
data = get_merged_pull_reqs(token, page)
88-
# assume we don't encounter it during the loop
89-
last_release_index = 101
90-
91-
for i in range(len(data)):
92-
if re.search(stopPattern, data[i]["title"]):
93-
found_last_release = True
94-
last_release_index = i
95-
break
96-
pull_reqs.extend(data[:last_release_index])
97-
page += 1
98-
99-
# should contain all the PRs since last release
100-
return pull_reqs

.github/scripts/build_assets/filehandler.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def get_icon_svgs_paths(folder_path: Path, icon_info: dict,
9191
for font_version in icon_info["versions"]["font"]:
9292
# if it's an alias, we don't want to make it into an icon
9393
if is_alias(font_version, aliases):
94-
print(f"Skipping this font since it's an alias: {icon_info['name']}-{font_version}.svg")
94+
print(f"Finding SVG filepaths: skipping this font since it's an alias: {icon_info['name']}-{font_version}.svg")
9595
continue
9696

9797
file_name = f"{icon_info['name']}-{font_version}.svg"
@@ -177,7 +177,7 @@ def rename_extracted_files(extract_path: str):
177177
},
178178
{
179179
"old": Path(extract_path, "style.css"),
180-
"new": Path(extract_path, "devicon.css")
180+
"new": Path(extract_path, "devicon-base.css")
181181
}
182182
]
183183

@@ -203,7 +203,7 @@ def create_screenshot_folder(dir, screenshot_name: str="screenshots/"):
203203
try:
204204
os.mkdir(screenshot_folder)
205205
except FileExistsError:
206-
print(f"{screenshot_folder} already exist. Script will do nothing.")
206+
print(f"{screenshot_folder} already exist. Not creating new folder.")
207207
finally:
208208
return str(screenshot_folder)
209209

0 commit comments

Comments
 (0)