forked from devicons/devicon
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Redo the workflow archs so we can comment on pr
- Loading branch information
1 parent
2e49bfa
commit 5bcd269
Showing
6 changed files
with
233 additions
and
76 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,36 +6,42 @@ jobs: | |
runs-on: windows-2019 | ||
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 (python, pip, npm) | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r ./.github/scripts/requirements.txt | ||
npm install | ||
- name: Executing build and create fonts via icomoon | ||
run: > | ||
python ./.github/scripts/icomoon_build.py | ||
./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe ./icomoon.json | ||
./devicon.json ./icons ./ --headless | ||
- name: Upload geckodriver.log for debugging purposes | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: geckodriver-log | ||
path: ./geckodriver.log | ||
|
||
- name: Build devicon.min.css | ||
if: success() | ||
run: npm run build-css | ||
|
||
- name: Upload screenshot of the newly made icons | ||
id: imgur_step | ||
uses: devicons/[email protected] | ||
if: success() | ||
with: | ||
path: ./new_icons.png | ||
client_id: ${{secrets.IMGUR_CLIENT_ID}} | ||
|
||
- name: Create Pull Request | ||
if: success() | ||
uses: peter-evans/create-pull-request@v3 | ||
|
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,65 +1,39 @@ | ||
name: Check SVGs On PR | ||
on: | ||
pull_request: | ||
paths: | ||
- '**.svg' # runs only when a svg is added in the PR | ||
on: pull_request | ||
jobs: | ||
check: | ||
name: Check the SVGs' quality | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- uses: actions/checkout@v2 # check out the merge branch of the PR and base | ||
- uses: actions/checkout@v2 | ||
- name: Setup Python v3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
- name: Install dependencies | ||
run: python -m pip install --upgrade pip | ||
- name: Find files added in this PR | ||
uses: lots0logs/[email protected] | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Run the check_svg script | ||
shell: bash | ||
run: > | ||
python ./.github/scripts/check_svgs_on_pr.py $HOME/files_added.json $HOME/files_modified.json | ||
- name: Comment on the PR about the result - Success | ||
if: success() | ||
uses: NejcZdovc/[email protected] | ||
env: | ||
MESSAGE: | | ||
Hi! | ||
I'm Devicons' SVG-Checker Bot and I just checked all the SVGs in this branch. | ||
python ./.github/scripts/check_svgs.py ./icomoon.json ./devicon.json ./icons | ||
Everything looks great. Good job! | ||
- 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 | ||
|
||
Have a nice day, | ||
SVG-Checker Bot :grin: | ||
- name: Upload the err messages | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
message: ${{ env.MESSAGE }} | ||
- name: Comment on the PR about the result - Failed | ||
if: failure() | ||
uses: NejcZdovc/[email protected] | ||
env: | ||
MESSAGE: | | ||
Hi! | ||
name: err_messages | ||
path: ./err_messages.txt | ||
|
||
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. | ||
Here is what went wrong: | ||
``` | ||
{0} | ||
``` | ||
For more reference, 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. | ||
- name: Save the pr num in an artifact | ||
shell: bash | ||
env: | ||
PR_NUM: ${{ github.event.number }} | ||
run: echo $PR_NUM > pr_num.txt | ||
|
||
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. | ||
- name: Upload the pr num | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
message: ${{ format(env.MESSAGE, env.SVG_ERR_MSGS)}} | ||
name: pr_num | ||
path: ./pr_num.txt |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,18 +5,21 @@ on: | |
jobs: | ||
build: | ||
name: Peek Icons | ||
if: contains(github.event.pull_request.labels.*.name, 'bot:peek') | ||
if: github.event.label.name == 'bot:peek' | ||
runs-on: windows-2019 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Setup Python v3.8 | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: 3.8 | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install -r ./.github/scripts/requirements.txt | ||
- name: Run icomoon_peek.py | ||
env: | ||
PR_TITLE: ${{ github.event.pull_request.title }} | ||
|
@@ -25,37 +28,29 @@ jobs: | |
python ./.github/scripts/icomoon_peek.py | ||
./.github/scripts/build_assets/geckodriver-v0.27.0-win64/geckodriver.exe ./icomoon.json | ||
./devicon.json ./icons ./ --headless --pr_title "%PR_TITLE%" | ||
- name: Upload screenshots for comments | ||
uses: actions/upload-artifact@v2 | ||
if: success() | ||
with: | ||
name: screenshots | ||
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 | ||
uses: actions/upload-artifact@v2 | ||
if: failure() | ||
with: | ||
name: geckodriver-log | ||
path: ./geckodriver.log | ||
- name: Comment on the PR about the result | ||
if: failure() | ||
uses: github-actions-up-and-running/[email protected] | ||
env: | ||
MESSAGE: | | ||
~Hi | ||
I'm Devicons' Peek Bot and it seems we've ran into a problem (sorry!). | ||
Please double check and fix the possible issues below: | ||
- 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) | ||
Once everything is fixed, I will try. If I still fail (sorry!), the maintainers will investigate further. | ||
Best of luck, | ||
Peek Bot :relaxed: | ||
with: | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
message: ${{env.MESSAGE}} | ||
path: ./geckodriver.log |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
name: Post the screenshots into a comment from Peek Icons workflow | ||
on: | ||
workflow_run: | ||
workflows: ["Check SVGs On PR"] | ||
types: | ||
- completed | ||
jobs: | ||
post_screenshots_in_comment: | ||
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: 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: Get the PR number and save it in $PR_NUM | ||
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: Comment on the PR about the result - Success | ||
uses: jungwinter/comment@v1 # let us comment on a specific PR | ||
id: create | ||
env: | ||
MESSAGE: | | ||
Hi! | ||
I'm Devicons' SVG-Checker Bot and I just checked all the SVGs in this branch. | ||
Everything looks great. Good job! | ||
Have a nice day, | ||
SVG-Checker Bot :grin: | ||
with: | ||
type: create | ||
issue_number: ${{ env.PR_NUM }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: ${{ env.MESSAGE }} | ||
|
||
- name: Comment on the PR about the result - Failure | ||
uses: jungwinter/comment@v1 # let us comment on a specific PR | ||
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. | ||
Here is what went wrong: | ||
``` | ||
{0} | ||
``` | ||
For more reference, 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: ${{ env.PR_NUM }} | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
body: ${{ format(env.MESSAGE, env.SVG_ERR_MSGS)}} |
Oops, something went wrong.