From c4250f64e666e4420f14542d90813131130f7dec Mon Sep 17 00:00:00 2001 From: unknown Date: Wed, 23 Nov 2022 05:05:11 -0300 Subject: [PATCH 1/3] Add a workflow to SVGO Optimizer --- .github/scripts/svgo.config.js | 53 ++++++++++++++++++++++++++++ .github/workflows/optimize_icons.yml | 20 +++++++++++ 2 files changed, 73 insertions(+) create mode 100644 .github/scripts/svgo.config.js create mode 100644 .github/workflows/optimize_icons.yml diff --git a/.github/scripts/svgo.config.js b/.github/scripts/svgo.config.js new file mode 100644 index 000000000..6d18a826a --- /dev/null +++ b/.github/scripts/svgo.config.js @@ -0,0 +1,53 @@ +module.exports = { + plugins: [ + { + name: 'preset-default' + }, + { + name: 'removeDimensions', + params: { + overrides: { + removeDimensions: true, + } + } + }, + { + name: 'convertStyleToAttrs', + params: { + overrides: { + convertStyleToAttrs: true, + } + } + }, + { + name: 'removeRasterImages', + params: { + overrides: { + removeRasterImages: true, + } + } + }, + { + name: 'removeScriptElement', + params: { + overrides: { + removeScriptElement: true, + } + } + }, + { + name: "removeAttrs", + params: { + attrs: [ + 'path:fill:none', + 'xml.space', + 'enable-background', + '^data.+', + 'stroke.*', + 'fill-rule', + 'clip-rule' + ] + } + } + ], +}; diff --git a/.github/workflows/optimize_icons.yml b/.github/workflows/optimize_icons.yml new file mode 100644 index 000000000..03dfda4d2 --- /dev/null +++ b/.github/workflows/optimize_icons.yml @@ -0,0 +1,20 @@ +name: Optimize icons +on: + - pull_request + +jobs: + optimize: + runs-on: ubuntu-latest + name: Optimize icons with SVGO + steps: + - uses: actions/checkout@v3 + + - uses: ericcornelissen/svgo-action@v3 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + svgo-config: ./.github/scripts/svgo.config.js + svgo-version: 3 + + - uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: Icons optimized by SVGO From 77cab6713e700dd7951e7dcc8fac7fec604aab9f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9lio=20J=C3=BAnior?= <76992016+lunatic-fox@users.noreply.github.com> Date: Thu, 24 Nov 2022 05:08:38 -0300 Subject: [PATCH 2/3] update `svgo.config.js` --- .github/scripts/svgo.config.js | 26 ++------------------------ 1 file changed, 2 insertions(+), 24 deletions(-) diff --git a/.github/scripts/svgo.config.js b/.github/scripts/svgo.config.js index 6d18a826a..06ae8b74c 100644 --- a/.github/scripts/svgo.config.js +++ b/.github/scripts/svgo.config.js @@ -11,22 +11,6 @@ module.exports = { } } }, - { - name: 'convertStyleToAttrs', - params: { - overrides: { - convertStyleToAttrs: true, - } - } - }, - { - name: 'removeRasterImages', - params: { - overrides: { - removeRasterImages: true, - } - } - }, { name: 'removeScriptElement', params: { @@ -39,15 +23,9 @@ module.exports = { name: "removeAttrs", params: { attrs: [ - 'path:fill:none', - 'xml.space', - 'enable-background', - '^data.+', - 'stroke.*', - 'fill-rule', - 'clip-rule' + 'path:fill:none' ] } } - ], + ] }; From f2175f3858f7e9994d5110046c475c188706ab5d Mon Sep 17 00:00:00 2001 From: unknown Date: Thu, 9 Feb 2023 04:05:10 -0300 Subject: [PATCH 3/3] Update optimize_icons.yml --- .github/workflows/optimize_icons.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/optimize_icons.yml b/.github/workflows/optimize_icons.yml index 03dfda4d2..1c2b12044 100644 --- a/.github/workflows/optimize_icons.yml +++ b/.github/workflows/optimize_icons.yml @@ -1,6 +1,7 @@ name: Optimize icons on: - pull_request +permissions: write-all jobs: optimize: