Skip to content

Commit d16d894

Browse files
authored
Merge pull request #454 from devicons/TB_uploadArtifact
Change the peek workflow to use upload artifacts
2 parents 6f94a07 + a1d95e3 commit d16d894

2 files changed

Lines changed: 115 additions & 51 deletions

File tree

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Peek Icons
2+
on:
3+
pull_request:
4+
types: [labeled]
5+
jobs:
6+
build:
7+
name: Get Fonts From Icomoon
8+
if: contains(github.event.pull_request.labels.*.name, 'bot:peek')
9+
runs-on: windows-2019
10+
steps:
11+
- uses: actions/checkout@v2
12+
- name: Setup Python v3.8
13+
uses: actions/setup-python@v2
14+
with:
15+
python-version: 3.8
16+
- name: Install dependencies
17+
run: |
18+
python -m pip install --upgrade pip
19+
pip install -r ./.github/scripts/requirements.txt
20+
- name: Run icomoon_peek.py
21+
env:
22+
PR_TITLE: ${{ github.event.pull_request.title }}
23+
shell: cmd
24+
run: >
25+
python ./.github/scripts/icomoon_peek.py
26+
./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe ./icomoon.json
27+
./devicon.json ./icons ./ --headless --pr_title "%PR_TITLE%"
28+
- name: Upload geckodriver.log for debugging purposes
29+
uses: actions/upload-artifact@v2
30+
if: failure()
31+
with:
32+
name: geckodriver-log
33+
path: ./geckodriver.log
34+
- name: Upload screenshot of the newly made icons
35+
id: icons_overview_img_step
36+
uses: devicons/public-upload-to-imgur@v2.1
37+
if: success()
38+
with:
39+
path: ./screenshots/new_icons.png
40+
client_id: ${{secrets.IMGUR_CLIENT_ID}}
41+
- name: Upload zoomed in screenshot of the newly made icons
42+
id: icons_detailed_img_step
43+
uses: devicons/public-upload-to-imgur@v2.1
44+
if: success()
45+
with:
46+
path: ./screenshots/screenshot_*.png
47+
client_id: ${{secrets.IMGUR_CLIENT_ID}}
48+
- name: Generate the markdowns for the screenshot and put it in the DETAILED_IMGS_MARKDOWN env var
49+
if: success()
50+
env:
51+
IMG_URLS: ${{ steps.icons_detailed_img_step.outputs.imgur_urls }}
52+
run: |
53+
echo 'DETAILED_IMGS_MARKDOWN<<EOF' >> $GITHUB_ENV
54+
python ./.github/scripts/generate_screenshot_markdown.py >> $GITHUB_ENV
55+
echo 'EOF' >> $GITHUB_ENV
56+
shell: bash
57+
- name: Comment on the PR about the result
58+
if: success()
59+
uses: github-actions-up-and-running/pr-comment@v1.0.1
60+
env:
61+
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
62+
MESSAGE: |
63+
Hi!
64+
65+
I'm Devicons' Peek Bot and I just peeked at the icons that you wanted to add using [icomoon.io](https://icomoon.io/app/#/select).
66+
Here is the result below:
67+
68+
![Peeked Icons (top left)]({0})
69+
70+
Here are the zoomed-in screenshots of the added icons:
71+
{1}
72+
73+
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.
74+
75+
The maintainers will now take a look at it and decide whether to merge your PR.
76+
77+
Thank you for contributing to Devicon! I hope everything works out and your icons are accepted into the repo.
78+
79+
Cheers :),
80+
81+
Peek Bot
82+
with:
83+
repo-token: ${{ secrets.GITHUB_TOKEN }}
84+
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}
85+
- name: Comment on the PR about the result
86+
if: failure()
87+
uses: github-actions-up-and-running/pr-comment@v1.0.1
88+
env:
89+
MESSAGE: |
90+
Hi!
91+
92+
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.
93+
94+
Can you please double check and fix the possible issues below:
95+
96+
- Your svgs are named and added correctly to the /icons folder as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#orgGuidelines).
97+
- Your icon information has been added to the `devicon.json` as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#updateDevicon)
98+
- Your PR title follows the format seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview)
99+
100+
Once everything is fixed, the maintainers will try again. If I still fail, the maintainers will investigate what cause this problem.
101+
102+
Thank you for your help :smile:
103+
104+
Cheers :),
105+
106+
Peek Bot
107+
with:
108+
repo-token: ${{ secrets.GITHUB_TOKEN }}
109+
message: ${{env.MESSAGE}}

.github/workflows/peek_icons.yml

Lines changed: 6 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -25,63 +25,18 @@ jobs:
2525
python ./.github/scripts/icomoon_peek.py
2626
./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe ./icomoon.json
2727
./devicon.json ./icons ./ --headless --pr_title "%PR_TITLE%"
28+
- name: Upload screenshots for comments
29+
uses: actions/upload-artifact@v2
30+
if: success()
31+
with:
32+
name: screenshots
33+
path: ./screenshots/*.png
2834
- name: Upload geckodriver.log for debugging purposes
2935
uses: actions/upload-artifact@v2
3036
if: failure()
3137
with:
3238
name: geckodriver-log
3339
path: ./geckodriver.log
34-
- name: Upload screenshot of the newly made icons
35-
id: icons_overview_img_step
36-
uses: devicons/public-upload-to-imgur@v2.1
37-
if: success()
38-
with:
39-
path: ./screenshots/new_icons.png
40-
client_id: ${{secrets.IMGUR_CLIENT_ID}}
41-
- name: Upload zoomed in screenshot of the newly made icons
42-
id: icons_detailed_img_step
43-
uses: devicons/public-upload-to-imgur@v2.1
44-
if: success()
45-
with:
46-
path: ./screenshots/screenshot_*.png
47-
client_id: ${{secrets.IMGUR_CLIENT_ID}}
48-
- name: Generate the markdowns for the screenshot and put it in the DETAILED_IMGS_MARKDOWN env var
49-
if: success()
50-
env:
51-
IMG_URLS: ${{ steps.icons_detailed_img_step.outputs.imgur_urls }}
52-
run: |
53-
echo 'DETAILED_IMGS_MARKDOWN<<EOF' >> $GITHUB_ENV
54-
python ./.github/scripts/generate_screenshot_markdown.py >> $GITHUB_ENV
55-
echo 'EOF' >> $GITHUB_ENV
56-
shell: bash
57-
- name: Comment on the PR about the result
58-
if: success()
59-
uses: github-actions-up-and-running/pr-comment@v1.0.1
60-
env:
61-
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }}
62-
MESSAGE: |
63-
Hi!
64-
65-
I'm Devicons' Peek Bot and I just peeked at the icons that you wanted to add using [icomoon.io](https://icomoon.io/app/#/select).
66-
Here is the result below:
67-
68-
![Peeked Icons (top left)]({0})
69-
70-
Here are the zoomed-in screenshots of the added icons:
71-
{1}
72-
73-
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.
74-
75-
The maintainers will now take a look at it and decide whether to merge your PR.
76-
77-
Thank you for contributing to Devicon! I hope everything works out and your icons are accepted into the repo.
78-
79-
Cheers :),
80-
81-
Peek Bot
82-
with:
83-
repo-token: ${{ secrets.GITHUB_TOKEN }}
84-
message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}}
8540
- name: Comment on the PR about the result
8641
if: failure()
8742
uses: github-actions-up-and-running/pr-comment@v1.0.1

0 commit comments

Comments
 (0)