1
0
mirror of https://github.com/konpa/devicon.git synced 2025-02-23 16:52:50 +01:00

Added comments and script now fail if can't find icon name

This commit is contained in:
Thomas Bui 2020-12-30 10:57:06 -08:00
parent a9eb51aca5
commit a84cd46a9f
3 changed files with 43 additions and 6 deletions

View File

@ -227,6 +227,10 @@ class SeleniumRunner:
def remove_color_from_icon(self):
"""
Remove the color from the most recent uploaded icon.
This is because some SVG have colors in them and we don't want to
force contributors to remove them in case people want the colored SVGs.
The color removal is also necessary so that the Icomoon-generated
icons fit within one font symbol/ligiature.
"""
color_tab = WebDriverWait(self.driver, self.SHORT_WAIT_IN_SEC).until(
ec.element_to_be_clickable((By.CSS_SELECTOR, "div.overlayWindow i.icon-droplet"))

View File

@ -1,5 +1,6 @@
from typing import List
import re
import sys
from selenium.common.exceptions import TimeoutException
# pycharm complains that build_assets is an unresolved ref
@ -20,18 +21,20 @@ def main():
print("Icons being uploaded:", *filtered_icons, sep = "\n")
if len(new_icons) == 0:
print("No files need to be uploaded. Ending script...")
return
sys.exit("No files need to be uploaded. Ending script...")
screenshot_folder = filehandler.create_screenshot_folder("./")
if len(filtered_icons) == 0:
print("No icons found matching the icon name in the PR's title. Fallback to uploading all new icons found.")
screenshot_folder = ""
sys.exit("No icons found matching the icon name in the PR's title.",
"Ensure that the PR title matches the convention here: ",
"https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview.",
"Ending script...",
sep='\n')
runner = None
try:
runner = SeleniumRunner(args.download_path, args.geckodriver_path, args.headless)
svgs = filehandler.get_svgs_paths(filtered_icons, args.icons_folder_path)
screenshot_folder = filehandler.create_screenshot_folder("./")
runner.upload_svgs(svgs, screenshot_folder)
print("Task completed.")
except TimeoutException as e:

View File

@ -58,6 +58,7 @@ jobs:
echo 'EOF' >> $GITHUB_ENV
shell: bash
- name: Comment on the PR about the result
if: success()
uses: github-actions-up-and-running/pr-comment@v1.0.1
env:
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
@ -72,13 +73,42 @@ jobs:
Here are the zoomed-in screenshots of the added icons:
{1}
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.
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.
The maintainers will now take a look at it and decide whether to merge your PR.
Thank you for contributing to Devicon! I hope everything works out and your icons are accepted into the repo.
Cheers :),
Peek Bot
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}
- name: Comment on the PR about the result
if: failure()
uses: github-actions-up-and-running/pr-comment@v1.0.1
env:
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
MESSAGE: |
Hi!
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.
Can you please double check and fix the possible issues below:
- Your svgs are named and added correctly to the /icons folder as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#orgGuidelines).
- Your icon information has been added to the `devicon.json` as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#updateDevicon)
- Your PR title follows the format seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview)
Once everything is fixed, the maintainers will try again. If I still fail, the maintainers will investigate what cause this problem.
Thank you for your help :smile
Cheers :),
Peek Bot
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}