Skip to content

The GitHub Action is that check file size if png images can be reduced.

License

Notifications You must be signed in to change notification settings

chick-p/action-png-size-lint

Repository files navigation

README

This GitHub Action is that check png files if the file size can be reduced.

Inputs

image-paths

The image file path as blob. Required.

limit

The allowed saving rate. Optional. Default is 80.

Usage

Example 1

Check the size of the png files in the fixtures directory.

name: lint
on:
  pull_request:
    paths:
      - "fixtures/**.png"
jobs:
  png-size-lint:
    runs-on: ubuntu-latest
    name: Image compress
    steps:
      - uses: actions/checkout@v4
      - name: Check size
        uses: chick-p/action-png-size-lint@v0
        with:
          image-paths: |
            fixtures/**/*.png
          limit: 90

Example 2

Check the size of png files in diff

name: lint
on:
  pull_request:
    paths:
      - "**.png"
jobs:
  png-size-lint:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - name: List changed files
        id: png-files
        run: |
          {
            echo 'CHANGED_FILES<<EOF'
            echo `git diff ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} --diff-filter=AM --name-only -- "*.png"`
            echo 'EOF'
          } >> $GITHUB_OUTPUT
      - uses: chick-p/action-png-size-lint@v0
        with:
          image-paths: ${{ steps.png-files.outputs.CHANGED_FILES }}
          limit: 90

About

The GitHub Action is that check file size if png images can be reduced.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •