All Projects → ericcornelissen → svgo-action

ericcornelissen / svgo-action

Licence: MIT license
Automatically run SVGO with GitHub Actions

Programming Languages

typescript
32286 projects
javascript
184084 projects - #8 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to svgo-action

code-owner-self-merge
A GitHub Action for letting CODEOWNERS merge PRs via green PR reviews
Stars: ✭ 43 (+138.89%)
Mutual labels:  actions
action-cats
A quick Github action which posts a cat gif on your PRs to reward you for pushing code!
Stars: ✭ 64 (+255.56%)
Mutual labels:  actions
electron-vue-boilerplate
Simple boilerplate for building Vue app with Electron and Webpack.
Stars: ✭ 53 (+194.44%)
Mutual labels:  svgo
CI-Report-Converter
The tool converts different error reporting standards for deep compatibility with popular CI systems (TeamCity, IntelliJ IDEA, GitHub Actions, etc).
Stars: ✭ 17 (-5.56%)
Mutual labels:  actions
link-snitch
GitHub Action to scan your site for broken links so you can fix them 🔗
Stars: ✭ 50 (+177.78%)
Mutual labels:  actions
vite-svg
Use SVG files as Vue components with Vite
Stars: ✭ 98 (+444.44%)
Mutual labels:  svgo
algoliasearch-crawler-github-actions
Algolia Crawler Github action
Stars: ✭ 24 (+33.33%)
Mutual labels:  actions
action-junit-report
Reports junit test results as GitHub Pull Request Check
Stars: ✭ 103 (+472.22%)
Mutual labels:  actions
node
npm's fork of nodejs/node, for sending PRs to update deps/npm
Stars: ✭ 30 (+66.67%)
Mutual labels:  actions
ssh2actions
Connect to GitHub Actions VM via SSH for interactive debugging
Stars: ✭ 62 (+244.44%)
Mutual labels:  actions
py-lambda-action
A Github Action to deploy AWS Lambda functions written in Python with their dependencies in a separate layer.
Stars: ✭ 49 (+172.22%)
Mutual labels:  actions
zola-deploy-action
Github action for building a Zola site and deploying to Github Pages
Stars: ✭ 131 (+627.78%)
Mutual labels:  actions
assign-one-project-github-action
Automatically add an issue or pull request to specific GitHub Project(s) when you create and/or label them.
Stars: ✭ 140 (+677.78%)
Mutual labels:  actions
chart-testing-action
A GitHub Action to lint and test Helm charts
Stars: ✭ 139 (+672.22%)
Mutual labels:  actions
gh-action-community
GitHub Action for the Community, from welcoming first timers to badges
Stars: ✭ 24 (+33.33%)
Mutual labels:  actions
gh-actions
A Github action for generating Terraform module documentation using terraform-docs and gomplate
Stars: ✭ 56 (+211.11%)
Mutual labels:  actions
xray-action
... a GitHub action to import test results into "Xray" - A complete Test Management tool for Jira.
Stars: ✭ 16 (-11.11%)
Mutual labels:  actions
jacoco-report
Github action that publishes the JaCoCo report as a comment in the Pull Request
Stars: ✭ 31 (+72.22%)
Mutual labels:  actions
staticcheck-action
Staticcheck's official GitHub Action
Stars: ✭ 47 (+161.11%)
Mutual labels:  actions
pipes
Репозиторий, который сам считает сколько у него звёзд.
Stars: ✭ 25 (+38.89%)
Mutual labels:  actions

SVGO Action

Build status Coverage Report Mutation Report Maintainability Snyk Status FOSSA Status

Automatically run SVGO with GitHub Actions.

Usage

Install the Action

Create a Workflow file (e.g.: .github/workflows/optimize.yml, see Creating a Workflow file) with the workflow below - or check out the examples for various complete workflows. You can also check what the Action does for each on event and what the Action outputs for subsequent steps.

name: Optimize
on:
# Comment the next line if you *don't* want the Action to run on Pull Requests.
  pull_request:
# Uncomment the next line if you want the Action to run on pushes.
#   push:
# Uncomment the next 2 lines if you want the Action to run on a schedule.
#   schedule:
#   - cron:  '0 * * * 1'  # See https://crontab.guru/
# Uncomment one of the next 2 lines if you want to manually trigger the Action.
#   repository_dispatch:
#   workflow_dispatch:

jobs:
  svgs:
    name: SVGs
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v3
    # Uncomment the next 2 lines to select a branch for on schedule or dispatch.
    #   with:
    #     ref: main
    - uses: ericcornelissen/svgo-action@v3
      with:
        repo-token: ${{ secrets.GITHUB_TOKEN }}

Note: This grants access to the GITHUB_TOKEN so the Action can make calls to GitHub's rest API. This is only needed for pull_request and push events.

Configure the Action

The following inputs are available when using the SVGO Action.

Name Description Default Documentation
dry-run Prevent the Action from writing changes false docs
ignore globs of SVGs that should be ignored "" docs
repo-token A GitHub token (secrets.GITHUB_TOKEN) "" docs
strict Fail on non-critical errors false docs
svgo-config The path of the SVGO configuration file "svgo.config.js" docs
svgo-version The version of SVGO to use 2 docs

To configure the Action you simply set a value for any of the above in the Workflow file. For example:

- uses: ericcornelissen/svgo-action@v3
  with:
    repo-token: ${{ secrets.GITHUB_TOKEN }}
    dry-run: true
    ignore: do/not/optimize/**/
    strict: false
    svgo-config: path/to/svgo-config.js
    svgo-version: 2

Advanced Usage

Limit Runs

Even though this Action won't do anything if a push or Pull Request does not touch any SVGs, you may want the Action to run only when an SVG has actually changed. To do this you can change the Workflow file that uses this Action to be triggered only when SVGs change. Update the value of pull_request and/or push as follows:

Warning This will cause the entire Workflow to be run only when an SVG changes. Jobs that should run for every push or Pull Request must be specified in a separate Workflow file.

on:
  pull_request:
    paths:
    - "**.svg"
  push:
    paths:
    - "**.svg"

Token Permissions

The minimum required permissions needed to run this Action are:

permissions:
  contents: read
  # Uncomment the next line if you're using the Action on Pull Requests
  #   pull-requests: read

# Or use `read-all` to allow reading in all scopes (recommended for open source)
permissions: read-all
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].