Warning
Support for SVGO Action ended 2024-04-30. We recommend finding an alternative and to not start nor continue using this Action.
This documentation describes all the inputs of the SVGO Action.
Please open an issue if you found a mistake or if you have suggestions for how to improve the documentation.
Name | Default value |
---|---|
dry-run |
false |
The dry-run
input can be used to run the Action without having it write any
changes. This can be useful for debugging or when you just want to give the
Action a try.
Note
If you misconfigure this input the Action assumes you wanted to enable it and
set dry-run
to true
.
To enable dry runs:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
dry-run: true
Name | Default value |
---|---|
ignore |
"" |
The ignore
input allows you to specify what SVGs should be ignored by the
Action. By default, no files are ignored. The value is interpreted as a glob,
if there are multiple lines each line is interpreted as a glob. Any file that
matches (any of) the configured glob(s) will not be optimized by the Action.
Note
Regardless of the value of this input, the Action will only consider files
with the .svg
file extension.
To ignore all files in a specific folder:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
ignore: not/optimized/*
To ignore all files in a specific folder and all its subfolders:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
ignore: not/optimized/**/
To have multiple ignore globs, use a YAML multiline string:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
ignore: |
folder1/*
folder2/**/
Name | Default value |
---|---|
repo-token |
"" |
The repo-token
input is required when using this Action on: pull_request
or on: push
. It is needed to make API request to GitHub so that the Action
can determine which SVGs should be optimized.
To set the repo-token
you will typically want to use:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
Name | Default value |
---|---|
strict |
false |
The strict
input can be used to enable strict mode. In strict mode, the
Action will fail in the event of a non-critical error (instead of just in the
event of a critical error).
Note
If you misconfigure this input the Action assumes you wanted to enable it and
set strict
to true
. This in turn results in the Action failing due to an
invalid input.
To enable strict mode:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
strict: true
Name | Default value |
---|---|
svgo-config |
"svgo.config.js" |
The svgo-config
input allows you to specify the location of the config file
for SVGO. The configuration file must be a JavaScript. If the specified file
is not found the Action will fall back on SVGO's default configuration.
To use an SVGO config file with a non-standard name:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
svgo-config: my-svgo-config.js
To use an SVGO config file in a folder:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
svgo-config: path/to/svgo.config.js
Name | Default value |
---|---|
svgo-version |
3 |
The svgo-version
input allows you to specify the version of SVGO that you
want to use. This can be either 3
for the latest v3 release, 2
for the
latest v2 release, or the string "project"
for the version of SVGO installed
for your project. For "project"
only SVGO v2 and v3 are supported.
To use the SVGO version 2:
# .github/workflows/optimize.yml
- uses: ericcornelissen/svgo-action@v4
with:
svgo-version: 2
To use the SVGO version used by your project:
# .github/workflows/optimize.yml
- name: Install dependencies, including SVGO
run: npm clean-install
- uses: ericcornelissen/svgo-action@v4
with:
svgo-version: project
Content licensed under CC BY-SA 4.0; Code snippets under the MIT license.