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.
npm i
or
yarn install
npm i @vercel/ncc -g
npm run build
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.
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)
The scripts and documentation in this project are released under the MIT License