Post the screenshots into a comment from Peek Icons workflow #1451
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Post the screenshots into a comment from Peek Icons workflow | |
on: | |
workflow_run: | |
workflows: ['Peek Icons'] | |
types: | |
- completed | |
jobs: | |
post_screenshots_in_comment: | |
name: Post the screenshot | |
runs-on: ubuntu-18.04 | |
if: github.event.action == 'completed' && github.event.workflow_run.conclusion != 'skipped' | |
env: | |
# three possible values: 'skipped', 'success', 'failure' | |
# have to print github.event to console to see these values | |
# note: can't use this env variable up in the if statement above for some reason. | |
# I don't think it's an ordering issue cause it seems 'if' is auto evaluate first | |
PEEK_STATUS: ${{ github.event.workflow_run.conclusion }} | |
steps: | |
- name: Check state of last run | |
run: echo $PEEK_STATUS | |
- name: Download workflow artifact | |
uses: dawidd6/[email protected] | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
workflow: peek_icons.yml | |
run_id: ${{ github.event.workflow_run.id }} | |
- name: Read the pr_num file | |
id: pr_num_reader | |
uses: juliangruber/[email protected] | |
with: | |
path: ./pr_num/pr_num.txt | |
- name: Read the err message file | |
if: success() | |
id: err_message_reader | |
uses: juliangruber/[email protected] | |
with: | |
path: ./err_messages/err_messages.txt | |
# using this trigger allowed us to access secrets | |
- name: Upload screenshot of the SVGs gotten from the artifacts | |
id: svgs_overview_img_step | |
if: env.PEEK_STATUS == 'success' && success() | |
uses: devicons/[email protected] | |
with: | |
path: ./screenshots/new_svgs.png | |
client_id: ${{secrets.IMGUR_CLIENT_ID}} | |
- name: Upload zoomed in screenshot of the SVGs gotten from the artifacts | |
id: svgs_detailed_img_step | |
uses: devicons/[email protected] | |
if: env.PEEK_STATUS == 'success' && success() | |
with: | |
path: ./screenshots/new_svg_*.png | |
client_id: ${{secrets.IMGUR_CLIENT_ID}} | |
- name: Upload screenshot of the newly made icons gotten from the artifacts | |
id: icons_overview_img_step | |
if: env.PEEK_STATUS == 'success' && success() | |
uses: devicons/[email protected] | |
with: | |
path: ./screenshots/new_icons.png | |
client_id: ${{secrets.IMGUR_CLIENT_ID}} | |
- name: Upload zoomed in screenshot of the newly made icons gotten from the artifacts | |
id: icons_detailed_img_step | |
uses: devicons/[email protected] | |
if: env.PEEK_STATUS == 'success' && success() | |
with: | |
path: ./screenshots/new_icon_*.png | |
client_id: ${{secrets.IMGUR_CLIENT_ID}} | |
- name: Upload zoomed in screenshot of the colored icons gotten from the artifacts | |
id: colored_icons_detailed_img_step | |
uses: devicons/[email protected] | |
if: env.PEEK_STATUS == 'success' && success() | |
with: | |
path: ./screenshots/new_colored_icon_*.png | |
client_id: ${{secrets.IMGUR_CLIENT_ID}} | |
- name: Comment on the PR about the result - Success | |
uses: jungwinter/comment@v1 # let us comment on a specific PR | |
if: env.PEEK_STATUS == 'success' && success() | |
env: | |
MESSAGE: | | |
Hi there, | |
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). | |
Here are the SVGs as intepreted by Icomoon when we upload the files: | |
{0} | |
Here are the zoomed-in screenshots of the added icons as **SVGs**: | |
{1} | |
Here are the icons that will be generated by Icomoon: | |
{2} | |
Here are the zoomed-in screenshots of the added icons as **icons**: | |
{3} | |
Here are the colored versions: | |
{4} | |
{5} | |
The maintainers will now check for: | |
1. The number of Glyphs matches the number of SVGs that were selected. | |
2. The icons (second group of pictures) look the same as the SVGs (first group of pictures). | |
3. The icons are of high quality (legible, matches the official logo, etc.) | |
In case of font issues, it might be caused by Icomoon not accepting strokes in the SVGs. Check this [doc](https://icomoon.io/#faq/importing) for more details and fix the issues as instructed by Icomoon and update this PR once you are done. | |
Thank you for contributing to Devicon! I hope that your icons are accepted into the repository. | |
Note: If the images don't show up, it has been autodeleted by Imgur after 6 months due to our API choice. | |
Cheers, | |
Peek Bot :blush: | |
with: | |
type: create | |
issue_number: ${{ steps.pr_num_reader.outputs.content }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: > | |
${{ | |
format( | |
env.MESSAGE, | |
fromJSON(steps.svgs_overview_img_step.outputs.markdown_urls)[0], | |
join(fromJSON(steps.svgs_detailed_img_step.outputs.markdown_urls), ' '), | |
fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0], | |
join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), ' '), | |
join(fromJSON(steps.colored_icons_detailed_img_step.outputs.markdown_urls), ' '), | |
steps.err_message_reader.outputs.content | |
) | |
}} | |
- name: Comment on the PR about the result - Failure | |
if: env.PEEK_STATUS == 'failure' | |
uses: jungwinter/comment@v1 # let us comment on a specific PR | |
env: | |
MESSAGE: | | |
Hi there, | |
I'm Devicons' Peek Bot and it seems we've ran into a problem. | |
``` | |
{0} | |
``` | |
Make sure that: | |
- 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) | |
I will retry once everything is fixed. If I still fail or there are other error, the maintainers will investigate. | |
Best of luck, | |
Peek Bot :relaxed: | |
with: | |
type: create | |
issue_number: ${{ steps.pr_num_reader.outputs.content }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: ${{ format(env.MESSAGE, steps.err_message_reader.outputs.content) }} | |
- name: Comment on the PR about the result - Failure | |
if: failure() | |
uses: jungwinter/comment@v1 # let us comment on a specific PR | |
env: | |
MESSAGE: | | |
Hi there, | |
I'm Devicons' Peek Bot and we've ran into a problem with the `post_peek_screenshot` workflow. | |
The maintainers will take a look and fix the issue. Please wait for further instructions. | |
Thank you, | |
Peek Bot :relaxed: | |
with: | |
type: create | |
issue_number: ${{ steps.pr_num_reader.outputs.content }} | |
token: ${{ secrets.GITHUB_TOKEN }} | |
body: env.MESSAGE |