Skip to content

Latest commit

 

History

History
74 lines (54 loc) · 2.23 KB

README.md

File metadata and controls

74 lines (54 loc) · 2.23 KB

Assets Checker

A Github Action to Analyse your static image files on generating Pull Request and warns if the size increase the threshold size. It check for .jpg, .svg, .png, .gif, .jpeg files.

Install

npm i or yarn install

Build

npm i @vercel/ncc -g
npm run build

Output Stats

Success -

Screenshot 2022-08-24 at 4 49 47 PM

Failure -

Screenshot 2022-08-24 at 4 49 39 PM

.assets-ignore file

Might be we have some images which size greater then the threshold we provided, in this case we can ignore these files by using .assets-ignore file.

.assets-ignore file must present inside the root directory of your repo :

Screenshot 2022-08-24 at 4 49 39 PM

The ignore assets name must be add as full path and separate - separate lines:

Screenshot 2022-08-24 at 4 49 39 PM

Usage:

Checkout action.yml

Please check the below code for detailed usage:

steps:
      - uses: bharatpe/assets-checker@main
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          target_folder: src/assets
          thrashold_size: 100

By default github actions work on node 12.For a specific node version use:

- uses: actions/setup-node@v1
        with:
          node-version: '16.16.0'

Ex:

steps:
      - uses: actions/setup-node@v1
        with:
          node-version: '16.16.0'
      - uses: bharatpe/assets-checker@main
        with:
          token: ${{ secrets.GITHUB_TOKEN }}
          target_folder: src/assets
          thrashold_size: 100

Also check Demo.yml for complete configuration(on using github actions)

License

The scripts and documentation in this project are released under the MIT License