Skip to content

Commit a84cd46

Browse files
committed
Added comments and script now fail if can't find icon name
1 parent a9eb51a commit a84cd46

3 files changed

Lines changed: 43 additions & 6 deletions

File tree

.github/scripts/build_assets/SeleniumRunner.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,10 @@ def click_on_just_added_icon(self, screenshot_folder: str, index: int):
227227
def remove_color_from_icon(self):
228228
"""
229229
Remove the color from the most recent uploaded icon.
230+
This is because some SVG have colors in them and we don't want to
231+
force contributors to remove them in case people want the colored SVGs.
232+
The color removal is also necessary so that the Icomoon-generated
233+
icons fit within one font symbol/ligiature.
230234
"""
231235
color_tab = WebDriverWait(self.driver, self.SHORT_WAIT_IN_SEC).until(
232236
ec.element_to_be_clickable((By.CSS_SELECTOR, "div.overlayWindow i.icon-droplet"))

.github/scripts/icomoon_peek.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from typing import List
22
import re
3+
import sys
34
from selenium.common.exceptions import TimeoutException
45

56
# pycharm complains that build_assets is an unresolved ref
@@ -20,18 +21,20 @@ def main():
2021
print("Icons being uploaded:", *filtered_icons, sep = "\n")
2122

2223
if len(new_icons) == 0:
23-
print("No files need to be uploaded. Ending script...")
24-
return
24+
sys.exit("No files need to be uploaded. Ending script...")
2525

26-
screenshot_folder = filehandler.create_screenshot_folder("./")
2726
if len(filtered_icons) == 0:
28-
print("No icons found matching the icon name in the PR's title. Fallback to uploading all new icons found.")
29-
screenshot_folder = ""
27+
sys.exit("No icons found matching the icon name in the PR's title.",
28+
"Ensure that the PR title matches the convention here: ",
29+
"https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview.",
30+
"Ending script...",
31+
sep='\n')
3032

3133
runner = None
3234
try:
3335
runner = SeleniumRunner(args.download_path, args.geckodriver_path, args.headless)
3436
svgs = filehandler.get_svgs_paths(filtered_icons, args.icons_folder_path)
37+
screenshot_folder = filehandler.create_screenshot_folder("./")
3538
runner.upload_svgs(svgs, screenshot_folder)
3639
print("Task completed.")
3740
except TimeoutException as e:

.github/workflows/peek_icons.yml

Lines changed: 31 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
echo 'EOF' >> $GITHUB_ENV
5959
shell: bash
6060
- name: Comment on the PR about the result
61+
if: success()
6162
uses: github-actions-up-and-running/pr-comment@v1.0.1
6263
env:
6364
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
@@ -72,13 +73,42 @@ jobs:
7273
Here are the zoomed-in screenshots of the added icons:
7374
{1}
7475
75-
Note: If the images doesn't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice.
76+
Note: If the images don't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice.
7677
7778
The maintainers will now take a look at it and decide whether to merge your PR.
7879
80+
Thank you for contributing to Devicon! I hope everything works out and your icons are accepted into the repo.
81+
82+
Cheers :),
83+
84+
Peek Bot
85+
with:
86+
repo-token: ${{ secrets.GITHUB_TOKEN }}
87+
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}
88+
- name: Comment on the PR about the result
89+
if: failure()
90+
uses: github-actions-up-and-running/pr-comment@v1.0.1
91+
env:
92+
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
93+
MESSAGE: |
94+
Hi!
95+
96+
I'm Devicons' Peek Bot and it seems we've ran into a problem. I'm supposed to check your svgs but I couldn't do my task due to an issue.
97+
98+
Can you please double check and fix the possible issues below:
99+
100+
- Your svgs are named and added correctly to the /icons folder as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#orgGuidelines).
101+
- Your icon information has been added to the `devicon.json` as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#updateDevicon)
102+
- Your PR title follows the format seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview)
103+
104+
Once everything is fixed, the maintainers will try again. If I still fail, the maintainers will investigate what cause this problem.
105+
106+
Thank you for your help :smile
107+
79108
Cheers :),
80109
81110
Peek Bot
82111
with:
83112
repo-token: ${{ secrets.GITHUB_TOKEN }}
84113
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}
114+

0 commit comments

Comments
 (0)