mirror of
https://github.com/konpa/devicon.git
synced 2025-09-01 10:25:11 +02:00
Added working workflow file
This commit is contained in:
24
.github/workflows/check_svgs_on_pr.yml
vendored
24
.github/workflows/check_svgs_on_pr.yml
vendored
@@ -6,34 +6,40 @@ jobs:
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Setup Python v3.8
|
||||
uses: actions/setup-python@v2
|
||||
|
||||
- uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: 3.8
|
||||
|
||||
- name: Install dependencies
|
||||
run: python -m pip install --upgrade pip
|
||||
|
||||
- name: Get Changed Files and generate files_added.json & files_modified.json
|
||||
uses: lots0logs/gh-action-get-changed-files@2.1.4
|
||||
with:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Run the check_svg script
|
||||
run: >
|
||||
python ./.github/scripts/check_svgs.py ./icomoon.json ./devicon.json ./icons
|
||||
|
||||
- name: Save the error messages in an artifact
|
||||
shell: bash
|
||||
run: echo $SVG_ERR_MSGS > err_messages.txt # the $SVG_ERR_MSGS is set by the python script above
|
||||
python ./.github/scripts/check_svgs_on_pr.py $HOME/files_added.json $HOME/files_modified.json
|
||||
|
||||
- name: Upload the err messages
|
||||
uses: actions/upload-artifact@v2
|
||||
if: success()
|
||||
with:
|
||||
name: err_messages
|
||||
path: ./err_messages.txt
|
||||
name: svg_err_messages
|
||||
path: ./svg_err_messages.txt
|
||||
|
||||
- name: Save the pr num in an artifact
|
||||
shell: bash
|
||||
if: success()
|
||||
env:
|
||||
PR_NUM: ${{ github.event.number }}
|
||||
run: echo $PR_NUM > pr_num.txt
|
||||
|
||||
- name: Upload the pr num
|
||||
uses: actions/upload-artifact@v2
|
||||
if: success()
|
||||
with:
|
||||
name: pr_num
|
||||
path: ./pr_num.txt
|
||||
|
51
.github/workflows/post_check_svgs_comment.yml
vendored
51
.github/workflows/post_check_svgs_comment.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: Post the screenshots into a comment from Peek Icons workflow
|
||||
name: Post the result of a SVG Check into its PR.
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Check SVGs On PR"]
|
||||
workflows: ['Check SVGs On PR']
|
||||
types:
|
||||
- completed
|
||||
jobs:
|
||||
@@ -9,9 +9,10 @@ jobs:
|
||||
name: Post the screenshot
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Fail the workflow if trigger failed so we can still comment on PR
|
||||
if: ${{ github.event.workflow_run.conclusion != 'success' }}
|
||||
run: echo "::error ::Check SVGs On PR workflow failed. Failing script"
|
||||
- name: Check if the trigger run worked. If it failed, fail the current run.
|
||||
# this is done cause this script should only post the err message if trigger run failed
|
||||
if: success() && 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
|
||||
@@ -21,20 +22,22 @@ jobs:
|
||||
run_id: ${{ github.event.workflow_run.id }}
|
||||
|
||||
- name: Get the PR number and save it in $PR_NUM
|
||||
if: success()
|
||||
run: |
|
||||
echo 'PR_NUM<<EOF' >> $GITHUB_ENV
|
||||
cat ./pr_num/pr_num.txt >> $GITHUB_ENV
|
||||
echo 'EOF' >> $GITHUB_ENV
|
||||
|
||||
- name: Get the error messages and save it in $SVG_ERR_MSGS
|
||||
run: |
|
||||
echo 'SVG_ERR_MSGS<<EOF' >> $GITHUB_ENV
|
||||
cat ./err_messages/err_messages.txt >> $GITHUB_ENV
|
||||
echo 'EOF' >> $GITHUB_ENV
|
||||
- name: Read the message file
|
||||
if: success()
|
||||
id: 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
|
||||
id: create
|
||||
if: success() && steps.message_reader.outputs.content == 'None'
|
||||
env:
|
||||
MESSAGE: |
|
||||
Hi!
|
||||
@@ -50,20 +53,21 @@ jobs:
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: ${{ env.MESSAGE }}
|
||||
|
||||
- name: Comment on the PR about the result - Failure
|
||||
- name: Comment on the PR about the result - SVG Error
|
||||
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
||||
if: success() && steps.message_reader.outputs.content != 'None'
|
||||
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.
|
||||
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, check out our [CONTRIBUTING guide](https://github.com/devicons/devicon/blob/develop/CONTRIBUTING.md#svgStandards)
|
||||
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.
|
||||
|
||||
@@ -71,6 +75,25 @@ jobs:
|
||||
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: ${{ env.PR_NUM }}
|
||||
token: ${{ secrets.GITHUB_TOKEN }}
|
||||
body: ${{ format(env.MESSAGE, steps.message_reader.outputs.content) }}
|
||||
|
||||
- name: Comment on the PR about the result - Failure
|
||||
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
||||
if: failure() || cancelled()
|
||||
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: ${{ env.PR_NUM }}
|
||||
|
19
.github/workflows/post_peek_screenshot.yml
vendored
19
.github/workflows/post_peek_screenshot.yml
vendored
@@ -1,7 +1,7 @@
|
||||
name: Post the screenshots into a comment from Peek Icons workflow
|
||||
on:
|
||||
workflow_run:
|
||||
workflows: ["Peek Icons"]
|
||||
workflows: ['Peek Icons']
|
||||
types:
|
||||
- completed
|
||||
jobs:
|
||||
@@ -9,9 +9,9 @@ jobs:
|
||||
name: Post the screenshot
|
||||
runs-on: ubuntu-18.04
|
||||
steps:
|
||||
- name: Fail the workflow if trigger failed so we can still comment on PR
|
||||
if: ${{ github.event.workflow_run.conclusion != 'success' }}
|
||||
run: echo "::error ::Peek Icons workflow failed. Failing script"
|
||||
- name: Check if the trigger run worked. If not, 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
|
||||
@@ -28,14 +28,14 @@ jobs:
|
||||
|
||||
- name: Upload screenshot of the newly made icons gotten from the artifacts
|
||||
id: icons_overview_img_step
|
||||
uses: devicons/public-upload-to-imgur@v2.2.0
|
||||
uses: devicons/public-upload-to-imgur@v2.2.1
|
||||
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/public-upload-to-imgur@v2.2.0
|
||||
uses: devicons/public-upload-to-imgur@v2.2.1
|
||||
if: success()
|
||||
with:
|
||||
path: ./screenshots/screenshot_*.png
|
||||
@@ -43,9 +43,10 @@ jobs:
|
||||
|
||||
- name: Comment on the PR about the result - Success
|
||||
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
||||
if: success()
|
||||
env:
|
||||
OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.markdown_urls)[0] }}
|
||||
DETAILED_IMGS_URL: ${{ join(fromJSON(steps.icons_detailed_img_step.outputs.markdown_urls), '\n') }}
|
||||
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), '\n') }}
|
||||
MESSAGE: |
|
||||
Hi there,
|
||||
|
||||
@@ -72,7 +73,7 @@ jobs:
|
||||
body: ${{format(env.MESSAGE, env.OVERVIEW_IMG_MARKDOWN, env.DETAILED_IMGS_MARKDOWN)}}
|
||||
|
||||
- name: Comment on the PR about the result - Failure
|
||||
if: failure()
|
||||
if: failure() || cancelled()
|
||||
uses: jungwinter/comment@v1 # let us comment on a specific PR
|
||||
env:
|
||||
MESSAGE: |
|
||||
|
Reference in New Issue
Block a user