Skip to content

Commit 2160753

Browse files
lunatic-foxSnailedltPanquesito7
authored
add feature: svgo auto optimization to pull requests (#1554)
* Add a workflow to SVGO Optimizer * update `svgo.config.js` * Update optimize_icons.yml --------- Co-authored-by: Jørgen Kalsnes Hagen <43886029+Snailedlt@users.noreply.github.com> Co-authored-by: David Leal <halfpacho@gmail.com>
1 parent 5f9ccb1 commit 2160753

2 files changed

Lines changed: 52 additions & 0 deletions

File tree

.github/scripts/svgo.config.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
module.exports = {
2+
plugins: [
3+
{
4+
name: 'preset-default'
5+
},
6+
{
7+
name: 'removeDimensions',
8+
params: {
9+
overrides: {
10+
removeDimensions: true,
11+
}
12+
}
13+
},
14+
{
15+
name: 'removeScriptElement',
16+
params: {
17+
overrides: {
18+
removeScriptElement: true,
19+
}
20+
}
21+
},
22+
{
23+
name: "removeAttrs",
24+
params: {
25+
attrs: [
26+
'path:fill:none'
27+
]
28+
}
29+
}
30+
]
31+
};
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Optimize icons
2+
on:
3+
- pull_request
4+
permissions: write-all
5+
6+
jobs:
7+
optimize:
8+
runs-on: ubuntu-latest
9+
name: Optimize icons with SVGO
10+
steps:
11+
- uses: actions/checkout@v3
12+
13+
- uses: ericcornelissen/svgo-action@v3
14+
with:
15+
repo-token: ${{ secrets.GITHUB_TOKEN }}
16+
svgo-config: ./.github/scripts/svgo.config.js
17+
svgo-version: 3
18+
19+
- uses: stefanzweifel/git-auto-commit-action@v4
20+
with:
21+
commit_message: Icons optimized by SVGO

0 commit comments

Comments
 (0)