From 3c4e8bcd87b70995ad709a1adb7e7e8f6b1c3239 Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Sun, 3 Jan 2021 13:24:03 -0800 Subject: [PATCH 1/5] Change the screenshot upload to using upload-artifacts --- .github/workflows/peek_icons.yml | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/.github/workflows/peek_icons.yml b/.github/workflows/peek_icons.yml index 90ed6fba..1bdfbae1 100644 --- a/.github/workflows/peek_icons.yml +++ b/.github/workflows/peek_icons.yml @@ -31,20 +31,25 @@ jobs: with: name: geckodriver-log path: ./geckodriver.log - - name: Upload screenshot of the newly made icons - id: icons_overview_img_step - uses: devicons/public-upload-to-imgur@v2.1 - if: success() + # - name: Upload screenshot of the newly made icons + # id: icons_overview_img_step + # uses: devicons/public-upload-to-imgur@v2.1 + # if: success() + # with: + # path: ./screenshots/new_icons.png + # client_id: ${{secrets.IMGUR_CLIENT_ID}} + # - name: Upload zoomed in screenshot of the newly made icons + # id: icons_detailed_img_step + # uses: devicons/public-upload-to-imgur@v2.1 + # if: success() + # with: + # path: ./screenshots/screenshot_*.png + # client_id: ${{secrets.IMGUR_CLIENT_ID}} + - name: + uses: actions/upload-artifact@v2 with: - path: ./screenshots/new_icons.png - client_id: ${{secrets.IMGUR_CLIENT_ID}} - - name: Upload zoomed in screenshot of the newly made icons - id: icons_detailed_img_step - uses: devicons/public-upload-to-imgur@v2.1 - if: success() - with: - path: ./screenshots/screenshot_*.png - client_id: ${{secrets.IMGUR_CLIENT_ID}} + name: screenshots + path: ./screenshots/*.png - name: Generate the markdowns for the screenshot and put it in the DETAILED_IMGS_MARKDOWN env var if: success() env: From 4fce919b5a86e5640c5b4ef8ebd3d6f9bb44723e Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Sun, 3 Jan 2021 13:33:56 -0800 Subject: [PATCH 2/5] Clean up the peek_icons.yml --- .../build_assets/drafts/peek_icons imgur.yml | 109 ++++++++++++++++++ .github/workflows/peek_icons.yml | 62 +--------- 2 files changed, 115 insertions(+), 56 deletions(-) create mode 100644 .github/scripts/build_assets/drafts/peek_icons imgur.yml diff --git a/.github/scripts/build_assets/drafts/peek_icons imgur.yml b/.github/scripts/build_assets/drafts/peek_icons imgur.yml new file mode 100644 index 00000000..90ed6fba --- /dev/null +++ b/.github/scripts/build_assets/drafts/peek_icons imgur.yml @@ -0,0 +1,109 @@ +name: Peek Icons +on: + pull_request: + types: [labeled] +jobs: + build: + name: Get Fonts From Icomoon + if: contains(github.event.pull_request.labels.*.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 }} + shell: cmd + run: > + 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 geckodriver.log for debugging purposes + uses: actions/upload-artifact@v2 + if: failure() + with: + name: geckodriver-log + path: ./geckodriver.log + - name: Upload screenshot of the newly made icons + id: icons_overview_img_step + uses: devicons/public-upload-to-imgur@v2.1 + if: success() + with: + path: ./screenshots/new_icons.png + client_id: ${{secrets.IMGUR_CLIENT_ID}} + - name: Upload zoomed in screenshot of the newly made icons + id: icons_detailed_img_step + uses: devicons/public-upload-to-imgur@v2.1 + if: success() + with: + path: ./screenshots/screenshot_*.png + client_id: ${{secrets.IMGUR_CLIENT_ID}} + - name: Generate the markdowns for the screenshot and put it in the DETAILED_IMGS_MARKDOWN env var + if: success() + env: + IMG_URLS: ${{ steps.icons_detailed_img_step.outputs.imgur_urls }} + run: | + echo 'DETAILED_IMGS_MARKDOWN<> $GITHUB_ENV + python ./.github/scripts/generate_screenshot_markdown.py >> $GITHUB_ENV + echo 'EOF' >> $GITHUB_ENV + shell: bash + - name: Comment on the PR about the result + if: success() + uses: github-actions-up-and-running/pr-comment@v1.0.1 + env: + OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }} + MESSAGE: | + Hi! + + 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 is the result below: + + ![Peeked Icons (top left)]({0}) + + Here are the zoomed-in screenshots of the added icons: + {1} + + Note: If the images don't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice. + + The maintainers will now take a look at it and decide whether to merge your PR. + + Thank you for contributing to Devicon! I hope everything works out and your icons are accepted into the repo. + + Cheers :), + + Peek Bot + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}} + - name: Comment on the PR about the result + if: failure() + uses: github-actions-up-and-running/pr-comment@v1.0.1 + env: + MESSAGE: | + Hi! + + I'm Devicons' Peek 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. + + Can you 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, the maintainers will try again. If I still fail, the maintainers will investigate what cause this problem. + + Thank you for your help :smile: + + Cheers :), + + Peek Bot + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + message: ${{env.MESSAGE}} diff --git a/.github/workflows/peek_icons.yml b/.github/workflows/peek_icons.yml index 1bdfbae1..3b968247 100644 --- a/.github/workflows/peek_icons.yml +++ b/.github/workflows/peek_icons.yml @@ -25,68 +25,18 @@ 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: + uses: actions/upload-artifact@v2 + if: success() + with: + name: screenshots + path: ./screenshots/*.png - name: Upload geckodriver.log for debugging purposes uses: actions/upload-artifact@v2 if: failure() with: name: geckodriver-log path: ./geckodriver.log - # - name: Upload screenshot of the newly made icons - # id: icons_overview_img_step - # uses: devicons/public-upload-to-imgur@v2.1 - # if: success() - # with: - # path: ./screenshots/new_icons.png - # client_id: ${{secrets.IMGUR_CLIENT_ID}} - # - name: Upload zoomed in screenshot of the newly made icons - # id: icons_detailed_img_step - # uses: devicons/public-upload-to-imgur@v2.1 - # if: success() - # with: - # path: ./screenshots/screenshot_*.png - # client_id: ${{secrets.IMGUR_CLIENT_ID}} - - name: - uses: actions/upload-artifact@v2 - with: - name: screenshots - path: ./screenshots/*.png - - name: Generate the markdowns for the screenshot and put it in the DETAILED_IMGS_MARKDOWN env var - if: success() - env: - IMG_URLS: ${{ steps.icons_detailed_img_step.outputs.imgur_urls }} - run: | - echo 'DETAILED_IMGS_MARKDOWN<> $GITHUB_ENV - python ./.github/scripts/generate_screenshot_markdown.py >> $GITHUB_ENV - echo 'EOF' >> $GITHUB_ENV - shell: bash - - name: Comment on the PR about the result - if: success() - uses: github-actions-up-and-running/pr-comment@v1.0.1 - env: - OVERVIEW_IMG_URL: ${{ fromJSON(steps.icons_overview_img_step.outputs.imgur_urls)[0] }} - MESSAGE: | - Hi! - - 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 is the result below: - - ![Peeked Icons (top left)]({0}) - - Here are the zoomed-in screenshots of the added icons: - {1} - - Note: If the images don't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice. - - The maintainers will now take a look at it and decide whether to merge your PR. - - Thank you for contributing to Devicon! I hope everything works out and your icons are accepted into the repo. - - Cheers :), - - Peek Bot - with: - repo-token: ${{ secrets.GITHUB_TOKEN }} - message: ${{format(env.MESSAGE, env.OVERVIEW_IMG_URL, env.DETAILED_IMGS_MARKDOWN)}} - name: Comment on the PR about the result if: failure() uses: github-actions-up-and-running/pr-comment@v1.0.1 From 6f94a07577a971475c4b658fdcbeda5ff148e8ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Enis=20Muli=C4=87?= Date: Mon, 4 Jan 2021 00:56:02 +0100 Subject: [PATCH 3/5] fix bash-plain (#451) --- icons/bash/bash-plain.svg | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/icons/bash/bash-plain.svg b/icons/bash/bash-plain.svg index 71c66f34..e7924566 100644 --- a/icons/bash/bash-plain.svg +++ b/icons/bash/bash-plain.svg @@ -3,28 +3,6 @@ viewBox="0 0 128 128" style="enable-background:new 0 0 128 128;" xml:space="preserve"> - - - - - - - - Date: Mon, 4 Jan 2021 01:55:11 +0100 Subject: [PATCH 5/5] fix bug where the content of svg could not be extracted when there was a comment above --- docs/assets/js/script.js | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/docs/assets/js/script.js b/docs/assets/js/script.js index f2637344..e85d13e9 100644 --- a/docs/assets/js/script.js +++ b/docs/assets/js/script.js @@ -118,11 +118,30 @@ devicon.controller('IconListCtrl', function($scope, $http, $compile) { $http.get(baseUrl + '/icons/' + $scope.selectedIcon.name + '/' + $scope.selectedIcon.name + '-' + svgVersion + '.svg').success(function(data){ - var svg = angular.element(data); - var innerSVG = (svg[0].innerHTML); + var svgElement = angular.element(data); + var innerSvgElement = null; - $scope.selectedSvgIcon = innerSVG; - $scope.selectedSvgIndex = index; + /** + * Loop trough svg image to find + * the actual svg content (not any comments or stuff + * we don't care for). + * See https://github.com/devicons/devicon/issues/444#issuecomment-753699913 + */ + for (const [key, value] of Object.entries(svgElement)) { + /** [object SVGSVGElement] ensures we have the actual svg content */ + if(value.toString() == '[object SVGSVGElement]') { + innerSvgElement = value; + break; + } + } + + if(innerSvgElement === null) { + console.error('Could not find content of given SVG.') + } else { + var innerSVG = (innerSvgElement.innerHTML); + $scope.selectedSvgIcon = innerSVG; + $scope.selectedSvgIndex = index; + } }); } /*---- End of "Change selected svg icon" ----*/