mirror of
https://github.com/konpa/devicon.git
synced 2025-08-01 04:10:22 +02:00
Fix issue with "post_peek_screenshot" action failing when it's not supposed to (#520)
* Change the boolean in post_check_svgs_comment * Fixed issue where post_peek action would fail randomly * Fixed post_peek action not acting correctly * Apply suggestions from code review (change to PR Number) Co-authored-by: David Leal <halfpacho@gmail.com> Co-authored-by: David Leal <halfpacho@gmail.com>
This commit is contained in:
31
.github/workflows/peek_icons.yml
vendored
31
.github/workflows/peek_icons.yml
vendored
@@ -3,7 +3,10 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
types: [labeled]
|
types: [labeled]
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
peek:
|
||||||
|
# four outcomes: successful check and upload,
|
||||||
|
# unsuccessful check (fail due to user),
|
||||||
|
# fail due to system, skipped
|
||||||
name: Peek Icons
|
name: Peek Icons
|
||||||
if: github.event.label.name == 'bot:peek'
|
if: github.event.label.name == 'bot:peek'
|
||||||
runs-on: windows-2019
|
runs-on: windows-2019
|
||||||
@@ -20,6 +23,18 @@ jobs:
|
|||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install -r ./.github/scripts/requirements.txt
|
pip install -r ./.github/scripts/requirements.txt
|
||||||
|
|
||||||
|
- name: Save the PR number in an artifact
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
PR_NUM: ${{ github.event.number }}
|
||||||
|
run: echo $PR_NUM > pr_num.txt
|
||||||
|
|
||||||
|
- name: Upload the PR number
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: pr_num
|
||||||
|
path: ./pr_num.txt
|
||||||
|
|
||||||
- name: Run icomoon_peek.py
|
- name: Run icomoon_peek.py
|
||||||
env:
|
env:
|
||||||
PR_TITLE: ${{ github.event.pull_request.title }}
|
PR_TITLE: ${{ github.event.pull_request.title }}
|
||||||
@@ -36,21 +51,9 @@ jobs:
|
|||||||
name: screenshots
|
name: screenshots
|
||||||
path: ./screenshots/*.png
|
path: ./screenshots/*.png
|
||||||
|
|
||||||
- name: Save the pr num in an artifact
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
PR_NUM: ${{ github.event.number }}
|
|
||||||
run: echo $PR_NUM > pr_num.txt
|
|
||||||
|
|
||||||
- name: Upload the pr num
|
|
||||||
uses: actions/upload-artifact@v2
|
|
||||||
with:
|
|
||||||
name: pr_num
|
|
||||||
path: ./pr_num.txt
|
|
||||||
|
|
||||||
- name: Upload geckodriver.log for debugging purposes
|
- name: Upload geckodriver.log for debugging purposes
|
||||||
uses: actions/upload-artifact@v2
|
uses: actions/upload-artifact@v2
|
||||||
if: failure()
|
if: failure()
|
||||||
with:
|
with:
|
||||||
name: geckodriver-log
|
name: geckodriver-log
|
||||||
path: ./geckodriver.log
|
path: ./geckodriver.log
|
||||||
|
29
.github/workflows/post_peek_screenshot.yml
vendored
29
.github/workflows/post_peek_screenshot.yml
vendored
@@ -8,10 +8,16 @@ jobs:
|
|||||||
post_screenshots_in_comment:
|
post_screenshots_in_comment:
|
||||||
name: Post the screenshot
|
name: Post the screenshot
|
||||||
runs-on: ubuntu-18.04
|
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:
|
steps:
|
||||||
- name: Check if the trigger run worked. If not, fail the current run.
|
- name: Check state of last run
|
||||||
if: github.event.workflow_run.conclusion != 'success'
|
run: echo $PEEK_STATUS
|
||||||
uses: cutenode/action-always-fail@v1.0.1
|
|
||||||
|
|
||||||
- name: Download workflow artifact
|
- name: Download workflow artifact
|
||||||
uses: dawidd6/action-download-artifact@v2.11.0
|
uses: dawidd6/action-download-artifact@v2.11.0
|
||||||
@@ -21,7 +27,6 @@ jobs:
|
|||||||
run_id: ${{ github.event.workflow_run.id }}
|
run_id: ${{ github.event.workflow_run.id }}
|
||||||
|
|
||||||
- name: Read the pr_num file
|
- name: Read the pr_num file
|
||||||
if: success()
|
|
||||||
id: pr_num_reader
|
id: pr_num_reader
|
||||||
uses: juliangruber/read-file-action@v1.0.0
|
uses: juliangruber/read-file-action@v1.0.0
|
||||||
with:
|
with:
|
||||||
@@ -29,6 +34,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Upload screenshot of the newly made icons gotten from the artifacts
|
- name: Upload screenshot of the newly made icons gotten from the artifacts
|
||||||
id: icons_overview_img_step
|
id: icons_overview_img_step
|
||||||
|
if: env.PEEK_STATUS == 'success' && success()
|
||||||
uses: devicons/public-upload-to-imgur@v2.2.1
|
uses: devicons/public-upload-to-imgur@v2.2.1
|
||||||
with:
|
with:
|
||||||
path: ./screenshots/new_icons.png
|
path: ./screenshots/new_icons.png
|
||||||
@@ -37,17 +43,15 @@ jobs:
|
|||||||
- name: Upload zoomed in screenshot of the newly made icons gotten from the artifacts
|
- name: Upload zoomed in screenshot of the newly made icons gotten from the artifacts
|
||||||
id: icons_detailed_img_step
|
id: icons_detailed_img_step
|
||||||
uses: devicons/public-upload-to-imgur@v2.2.1
|
uses: devicons/public-upload-to-imgur@v2.2.1
|
||||||
if: success()
|
if: env.PEEK_STATUS == 'success' && success()
|
||||||
with:
|
with:
|
||||||
path: ./screenshots/screenshot_*.png
|
path: ./screenshots/screenshot_*.png
|
||||||
client_id: ${{secrets.IMGUR_CLIENT_ID}}
|
client_id: ${{secrets.IMGUR_CLIENT_ID}}
|
||||||
|
|
||||||
- name: Comment on the PR about the result - Success
|
- name: Comment on the PR about the result - Success
|
||||||
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
||||||
if: success()
|
if: env.PEEK_STATUS == 'success' && success()
|
||||||
env:
|
env:
|
||||||
OVERVIEW_IMG_MARKDOWN: ${{ fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0] }}
|
|
||||||
DETAILED_IMGS_MARKDOWN: ${{ join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '') }}
|
|
||||||
MESSAGE: |
|
MESSAGE: |
|
||||||
Hi there,
|
Hi there,
|
||||||
|
|
||||||
@@ -71,10 +75,13 @@ jobs:
|
|||||||
type: create
|
type: create
|
||||||
issue_number: ${{ steps.pr_num_reader.outputs.content }}
|
issue_number: ${{ steps.pr_num_reader.outputs.content }}
|
||||||
token: ${{ secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
body: ${{format(env.MESSAGE, env.OVERVIEW_IMG_MARKDOWN, env.DETAILED_IMGS_MARKDOWN)}}
|
body: >
|
||||||
|
${{ format(env.MESSAGE,
|
||||||
|
fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0],
|
||||||
|
join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '')) }}
|
||||||
|
|
||||||
- name: Comment on the PR about the result - Failure
|
- name: Comment on the PR about the result - Failure
|
||||||
if: failure() || cancelled()
|
if: failure() || env.PEEK_STATUS == 'failure'
|
||||||
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
||||||
env:
|
env:
|
||||||
MESSAGE: |
|
MESSAGE: |
|
||||||
@@ -88,7 +95,7 @@ jobs:
|
|||||||
- Your icon information has been added to the `devicon.json` as seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#updateDevicon)
|
- 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)
|
- Your PR title follows the format seen [here](https://github.com/devicons/devicon/blob/master/CONTRIBUTING.md#overview)
|
||||||
|
|
||||||
Once everything is fixed, I will try. If I still fail (sorry!), the maintainers will investigate further.
|
I will retry once everything is fixed. If I still fail (sorry!) or there are other erros, the maintainers will investigate.
|
||||||
|
|
||||||
Best of luck,
|
Best of luck,
|
||||||
Peek Bot :relaxed:
|
Peek Bot :relaxed:
|
||||||
|
Reference in New Issue
Block a user