From ab0cba5eba4cc080de47ff4d3543083abf0faf3d Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Fri, 18 Dec 2020 23:24:27 -0800 Subject: [PATCH 1/4] Add the public-upload-to-imgur action --- .github/scripts/icomoon_peek.py | 6 +++--- .github/workflows/peek_icons.yml | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/scripts/icomoon_peek.py b/.github/scripts/icomoon_peek.py index 6fd55f59c..5f11e3174 100644 --- a/.github/scripts/icomoon_peek.py +++ b/.github/scripts/icomoon_peek.py @@ -9,9 +9,9 @@ def main(): args = util.get_commandline_args() new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path) - if len(new_icons) == 0: - print("No files need to be uploaded. Ending script...") - return + # if len(new_icons) == 0: + # print("No files need to be uploaded. Ending script...") + # return # print list of new icons print("List of new icons:", *new_icons, sep = "\n") diff --git a/.github/workflows/peek_icons.yml b/.github/workflows/peek_icons.yml index 5bc2953a4..ca34a51cf 100644 --- a/.github/workflows/peek_icons.yml +++ b/.github/workflows/peek_icons.yml @@ -29,11 +29,11 @@ jobs: name: geckodriver-log path: ./geckodriver.log - name: Upload screenshot of the newly made icons - uses: actions/upload-artifact@v2 + uses: Thomas-Boi/public-upload-to-imgur@v1 if: ${{success()}} with: - name: new_icons - path: ./new_icons.png + img_path: ./new_icons.png + client_id: ${{secrets.IMGUR_CLIENT_ID}} # - name: Comment on the PR about the result # uses: github-actions-up-and-running/pr-comment@v1.0.1 # with: From f51bda7d29a3b41107f30308a59c32ffedbd28fa Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Sat, 19 Dec 2020 00:20:34 -0800 Subject: [PATCH 2/4] Added pr comment action --- .github/workflows/peek_icons.yml | 37 +++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/.github/workflows/peek_icons.yml b/.github/workflows/peek_icons.yml index ca34a51cf..1c6d6c9a3 100644 --- a/.github/workflows/peek_icons.yml +++ b/.github/workflows/peek_icons.yml @@ -16,7 +16,7 @@ jobs: uses: actions/setup-python@v2 with: python-version: 3.8 - - name: Install dependencies (python, pip) + - name: Install dependencies run: | python -m pip install --upgrade pip pip install -r ./.github/scripts/requirements.txt @@ -29,22 +29,35 @@ jobs: name: geckodriver-log path: ./geckodriver.log - name: Upload screenshot of the newly made icons + id: imgur_step uses: Thomas-Boi/public-upload-to-imgur@v1 if: ${{success()}} with: img_path: ./new_icons.png client_id: ${{secrets.IMGUR_CLIENT_ID}} - # - name: Comment on the PR about the result - # uses: github-actions-up-and-running/pr-comment@v1.0.1 - # with: - # repo-token: ${{ secrets.GITHUB_TOKEN }} - # message: > - # Hi! I'm Devicons' GitHub Actions Bot! + - name: Comment on the PR about the result + uses: github-actions-up-and-running/pr-comment@v1.0.1 + env: + IMG_URL: ${{ steps.imgur_step.outputs.imgur_url }} + MESSAGE: > + Hi! I'm Devicons' Peek Bot! - # I just peeked at the icons that you wanted to add and upload them to the - # [Actions page](https://github.com/devicons/devicon/actions). The maintainers - # will now take a look at it and decide whether to merge your PR. + I just peeked at the icons that you wanted to add using [icomoon.io](https://icomoon.io/app/#/select). - # Cheers :), + Here is the result below: + + ![Peeked Icons (top left)]({0}) + + Note: If the image doesn't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice. + + Here is [the url]({1}). + + + The maintainers will now take a look at it and decide whether to merge your PR. + + Cheers :), - # Bot + Peek Bot + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + message: ${{format(env.MESSAGE, env.IMG_URL, env.IMG_URL)}} From 426d9507e350b80ae71b5411956463dfc4931e99 Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Sat, 19 Dec 2020 00:28:34 -0800 Subject: [PATCH 3/4] Finalize new peek action workflow --- .github/scripts/icomoon_peek.py | 6 +++--- .github/workflows/peek_icons.yml | 10 +++++++--- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/scripts/icomoon_peek.py b/.github/scripts/icomoon_peek.py index 5f11e3174..6fd55f59c 100644 --- a/.github/scripts/icomoon_peek.py +++ b/.github/scripts/icomoon_peek.py @@ -9,9 +9,9 @@ def main(): args = util.get_commandline_args() new_icons = filehandler.find_new_icons(args.devicon_json_path, args.icomoon_json_path) - # if len(new_icons) == 0: - # print("No files need to be uploaded. Ending script...") - # return + if len(new_icons) == 0: + print("No files need to be uploaded. Ending script...") + return # print list of new icons print("List of new icons:", *new_icons, sep = "\n") diff --git a/.github/workflows/peek_icons.yml b/.github/workflows/peek_icons.yml index 1c6d6c9a3..d40bf75bc 100644 --- a/.github/workflows/peek_icons.yml +++ b/.github/workflows/peek_icons.yml @@ -40,16 +40,20 @@ jobs: env: IMG_URL: ${{ steps.imgur_step.outputs.imgur_url }} MESSAGE: > - Hi! I'm Devicons' Peek Bot! - - I just peeked at the icons that you wanted to add using [icomoon.io](https://icomoon.io/app/#/select). + 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}) + Note: If the image doesn't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice. + Here is [the url]({1}). From 4ec9d858052c154e75fe95cf9ac7ab5fb84145d6 Mon Sep 17 00:00:00 2001 From: Thomas Bui Date: Sun, 27 Dec 2020 18:36:06 -0800 Subject: [PATCH 4/4] Updated the workflow yaml to use the new repo --- .github/workflows/build_icons.yml | 24 +++++++++++++++++------- .github/workflows/peek_icons.yml | 12 ++---------- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build_icons.yml b/.github/workflows/build_icons.yml index 33a764e67..ea0089555 100644 --- a/.github/workflows/build_icons.yml +++ b/.github/workflows/build_icons.yml @@ -26,22 +26,32 @@ jobs: with: name: geckodriver-log path: ./geckodriver.log - - name: Upload screenshot of the newly made icons - uses: actions/upload-artifact@v2 - if: ${{success()}} - with: - name: new_icons - path: ./new_icons.png - 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/public-upload-to-imgur@v1 + if: ${{success()}} + with: + img_path: ./new_icons.png + client_id: ${{secrets.IMGUR_CLIENT_ID}} - name: Create Pull Request if: ${{ success() }} uses: peter-evans/create-pull-request@v3 + env: + MESSAGE: | + Automated font-building task ran by GitHub Actions bot. This PR built new font files and devicon.css file. + + Here are all the files that were built: + + ![Files Built]({0}) + + More information can be found in the GitHub Action logs for this workflow. with: branch: 'master-build-result' base: 'master' commit-message: 'Built new icons, icomoon.json and devicon.css' title: 'bot:build new icons, icomoon.json and devicon.css' - body: 'Automated font-building task ran by GitHub Actions bot' + body: ${{ format(env.MESSAGE, steps.imgur_step.outputs.imgur_url ) }} delete-branch: true diff --git a/.github/workflows/peek_icons.yml b/.github/workflows/peek_icons.yml index d40bf75bc..a99bc5bdd 100644 --- a/.github/workflows/peek_icons.yml +++ b/.github/workflows/peek_icons.yml @@ -30,7 +30,7 @@ jobs: path: ./geckodriver.log - name: Upload screenshot of the newly made icons id: imgur_step - uses: Thomas-Boi/public-upload-to-imgur@v1 + uses: devicons/public-upload-to-imgur@v1 if: ${{success()}} with: img_path: ./new_icons.png @@ -39,24 +39,16 @@ jobs: uses: github-actions-up-and-running/pr-comment@v1.0.1 env: IMG_URL: ${{ steps.imgur_step.outputs.imgur_url }} - MESSAGE: > + 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}) - Note: If the image doesn't show up, it's probably because it has been autodeleted by Imgur after 6 months due to our API choice. - - Here is [the url]({1}). - - The maintainers will now take a look at it and decide whether to merge your PR. Cheers :),