Skip to content

Commit a9eb51a

Browse files
committed
Various bug fixes and added ability to comment multiple files
1 parent c388503 commit a9eb51a

11 files changed

Lines changed: 20 additions & 74 deletions

File tree

.github/scripts/build_assets/arg_getters.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
from argparse import ArgumentParser
22
from build_assets.PathResolverAction import PathResolverAction
33

4+
45
def get_selenium_runner_args(peek_mode=False):
56
parser = ArgumentParser(description="Upload svgs to Icomoon to create icon files.")
67

@@ -32,13 +33,4 @@ def get_selenium_runner_args(peek_mode=False):
3233
parser.add_argument("--pr_title",
3334
help="The title of the PR that we are peeking at")
3435

35-
return parser.parse_args()
36-
37-
38-
def get_generate_markdown_args():
39-
parser = ArgumentParser(description="Generate markdown for the image urls passed in.")
40-
41-
parser.add_argument("img_urls",
42-
help="The urls of the images. Must be the string/JSON form of an array. Ex: '[1,2,3]'")
43-
4436
return parser.parse_args()
Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,10 @@
1-
from typing import List
1+
import json
2+
import os
23

3-
from build_assets import arg_getters
44

5-
6-
def generate_screenshot_markdown(img_urls: List[str]):
7-
"""
8-
Generate the markdown for the screenshots using the
9-
img_urls then print it to the console.
10-
:param img_urls are valid image links.
11-
"""
5+
if __name__ == "__main__":
6+
img_urls_list = json.loads(os.environ["IMG_URLS"])
127
template = "![Detailed Screenshot]({})"
13-
return [template.format(img_url) for img_url in img_urls]
8+
markdown = [template.format(img_url) for img_url in img_urls_list]
9+
print("\n\n".join(markdown))
1410

15-
16-
if __name__ == "__main__":
17-
args = arg_getters.get_generate_markdown_args()
18-
markdown = generate_screenshot_markdown(args.img_urls)
19-
print("\n\n".join(markdown)) # format it before printing

.github/workflows/build_icons.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ jobs:
3434
run: npm run build-css
3535
- name: Upload screenshot of the newly made icons
3636
id: imgur_step
37-
uses: devicons/public-upload-to-imgur@v1.1.2
37+
uses: devicons/public-upload-to-imgur@v2
3838
if: success()
3939
with:
4040
path: ./new_icons.png

.github/workflows/peek_icons.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,31 +35,32 @@ jobs:
3535
name: geckodriver-log
3636
path: ./geckodriver.log
3737
- name: Upload screenshot of the newly made icons
38-
id: new_icons_overview_step
39-
uses: devicons/public-upload-to-imgur@main
38+
id: icons_overview_img_step
39+
uses: devicons/public-upload-to-imgur@v2
4040
if: success()
4141
with:
4242
path: ./screenshots/new_icons.png
4343
client_id: ${{secrets.IMGUR_CLIENT_ID}}
4444
- name: Upload zoomed in screenshot of the newly made icons
45-
id: new_icons_detailed_step
46-
uses: devicons/public-upload-to-imgur@main
45+
id: icons_detailed_img_step
46+
uses: devicons/public-upload-to-imgur@v2
4747
if: success()
4848
with:
4949
path: ./screenshots/screenshot_*.png
5050
client_id: ${{secrets.IMGUR_CLIENT_ID}}
5151
- name: Generate the markdowns for the screenshot and put it in the DETAILED_IMGS_MARKDOWN env var
52+
if: success()
5253
env:
53-
IMG_URLS: ${{ steps.new_icons_detailed_step.outputs.img_url }}
54+
IMG_URLS: ${{ steps.icons_detailed_img_step.outputs.imgur_urls }}
5455
run: |
55-
echo "DETAILED_IMGS_MARKDOWN<<EOF" >> $GITHUB_ENV
56-
python ./.github/scripts/generate_screenshot_markdown.py "%IMG_URLS%" >> $GITHUB_ENV
57-
echo "EOF" >> $GITHUB_ENV
58-
shell: cmd
56+
echo 'DETAILED_IMGS_MARKDOWN<<EOF' >> $GITHUB_ENV
57+
python ./.github/scripts/generate_screenshot_markdown.py >> $GITHUB_ENV
58+
echo 'EOF' >> $GITHUB_ENV
59+
shell: bash
5960
- name: Comment on the PR about the result
6061
uses: github-actions-up-and-running/pr-comment@v1.0.1
6162
env:
62-
OVERVIEW_IMG_URL: ${{ steps.imgur_step.outputs.imgur_url }}
63+
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
6364
MESSAGE: |
6465
Hi!
6566
@@ -80,4 +81,4 @@ jobs:
8081
Peek Bot
8182
with:
8283
repo-token: ${{ secrets.GITHUB_TOKEN }}
83-
message: ${{format(env.MESSAGE, env.IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}
84+
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}

devicon.json

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2173,40 +2173,6 @@
21732173
"color": "#a62c46",
21742174
"aliases": []
21752175
},
2176-
{
2177-
"name": "testingicon",
2178-
"tags": [
2179-
"framework"
2180-
],
2181-
"versions": {
2182-
"svg": [
2183-
"original",
2184-
"plain"
2185-
],
2186-
"font": [
2187-
"plain"
2188-
]
2189-
},
2190-
"color": "#61dafb",
2191-
"aliases": [ ]
2192-
},
2193-
{
2194-
"name": "testingicon2",
2195-
"tags": [
2196-
"framework"
2197-
],
2198-
"versions": {
2199-
"svg": [
2200-
"original",
2201-
"plain"
2202-
],
2203-
"font": [
2204-
"plain"
2205-
]
2206-
},
2207-
"color": "#61dafb",
2208-
"aliases": [ ]
2209-
},
22102176
{
22112177
"name": "react",
22122178
"tags": [

icons/testingicon/testingicon-original.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

icons/testingicon/testingicon-plain.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

icons/testingicon/testingicon.eps

-1.15 MB
Binary file not shown.

icons/testingicon2/testingicon2-original.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

icons/testingicon2/testingicon2-plain.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)