diff --git a/.github/scripts/svgo.config.js b/.github/scripts/svgo.config.js new file mode 100644 index 00000000..06ae8b74 --- /dev/null +++ b/.github/scripts/svgo.config.js @@ -0,0 +1,31 @@ +module.exports = { + plugins: [ + { + name: 'preset-default' + }, + { + name: 'removeDimensions', + params: { + overrides: { + removeDimensions: true, + } + } + }, + { + name: 'removeScriptElement', + params: { + overrides: { + removeScriptElement: true, + } + } + }, + { + name: "removeAttrs", + params: { + attrs: [ + 'path:fill:none' + ] + } + } + ] +}; diff --git a/.github/workflows/optimize_icons.yml b/.github/workflows/optimize_icons.yml new file mode 100644 index 00000000..1c2b1204 --- /dev/null +++ b/.github/workflows/optimize_icons.yml @@ -0,0 +1,21 @@ +name: Optimize icons +on: + - pull_request +permissions: write-all + +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