Skip to content
This repository has been archived by the owner on Apr 30, 2024. It is now read-only.

Latest commit

 

History

History
235 lines (164 loc) · 5.34 KB

inputs.md

File metadata and controls

235 lines (164 loc) · 5.34 KB

SVGO Action Inputs

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.


Dry Run

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.

Examples

To enable dry runs:

# .github/workflows/optimize.yml

- uses: ericcornelissen/svgo-action@v4
  with:
    dry-run: true

Ignore

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.

Examples

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/**/

Repository Token

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.

Examples

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 }}

Strict Mode

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.

Examples

To enable strict mode:

# .github/workflows/optimize.yml

- uses: ericcornelissen/svgo-action@v4
  with:
    strict: true

SVGO Config

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.

Examples

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

SVGO Version

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.

Examples

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.