1
0
mirror of https://github.com/konpa/devicon.git synced 2025-02-24 17:22:28 +01:00
devicon/.github/workflows/post_check_svgs_comment.yml

105 lines
3.9 KiB
YAML

name: Post the result of a SVG Check into its PR.
on:
workflow_run:
workflows: ['Check SVGs On PR']
types:
- completed
jobs:
post_result_of_svg_check:
name: Post the result of the Check SVG Action
runs-on: ubuntu-18.04
steps:
- name: Check if the trigger run worked. If it failed, fail the current run.
if: github.event.workflow_run.conclusion != 'success'
uses: cutenode/action-always-fail@v1.0.1
- name: Download workflow artifact
uses: dawidd6/action-download-artifact@v2.11.0
if: success()
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
workflow: peek_icons.yml
run_id: ${{ github.event.workflow_run.id }}
- name: Read the pr_num file
if: success()
id: pr_num_reader
uses: juliangruber/read-file-action@v1.0.0
with:
path: ./pr_num/pr_num.txt
- name: Read the err message file
if: success()
id: err_message_reader
uses: juliangruber/read-file-action@v1.0.0
with:
path: ./svg_err_messages/svg_err_messages.txt
# - name: Comment on the PR about the result - Success
# uses: jungwinter/comment@v1 # let us comment on a specific PR
# if: success() && steps.err_message_reader.outputs.content == '1'
# env:
# MESSAGE: |
# Hi!
# I'm Devicons' SVG-Checker Bot and everything looks great. Good job!
# Have a nice day,
# SVG-Checker Bot :grin:
# with:
# type: create
# issue_number: ${{ steps.pr_num_reader.outputs.content }}
# token: ${{ secrets.GITHUB_TOKEN }}
# body: ${{ env.MESSAGE }}
- name: Comment on the PR about the result - SVG Error
uses: jungwinter/comment@v1 # let us comment on a specific PR
if: success() && (steps.err_message_reader.outputs.content != '0' && steps.err_message_reader.outputs.content != '1')
env:
MESSAGE: |
Hi!
I'm Devicons' SVG-Checker Bot and it seems we have some issues with your SVGs.
Here is what went wrong:
```
{0}
```
For more reference on why these are errors, check out our [CONTRIBUTING guide](https://github.com/devicons/devicon/blob/develop/CONTRIBUTING.md#svgStandards)
Please address these issues. When you update this PR, I will check your SVGs again.
Thanks for your help,
SVG-Checker Bot :smile:
PS. One day, I will be smart enough to fix these errors for you :persevere:. Until then, I can only point them out.
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) }}
# if we posted error messages before, we fail this entire workflow
- name: Fail workflow is there is an error.
uses: cutenode/action-always-fail@v1.0.1
if: success() && (steps.err_message_reader.outputs.content != '0' && steps.err_message_reader.outputs.content != '1')
- name: Comment on the PR about the result - Failure
uses: jungwinter/comment@v1 # let us comment on a specific PR
if: failure()
env:
MESSAGE: |
Hi!
I'm Devicons' SVG-Checker 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.
Please let my maintainers know of the issues. They will take a look at my work and try to resolve the problem. Until then, please hang tight and sorry for the inconvenience.
Cheers,
SVG-Checker Bot :smile:
with:
type: create
issue_number: ${{ steps.pr_num_reader.outputs.content }}
token: ${{ secrets.GITHUB_TOKEN }}
body: ${{ env.MESSAGE }}