Filesize Guard is a lightweight GitHub Action designed to prevent bloating your repository or downloadable app size by introducing large assets. It ensures assets exceeding a specified size limit are flagged, encouraging optimization or offloading to a CDN.
- Prevents large assets from being unintentionally added to the repository.
- Configurable size limit (default: 100 kB).
- Supports
.gitignore-like syntax to exclude specific files or directories.
Create a GitHub Actions workflow in .github/workflows/filesize_guard.yml:
name: Filesize Guard
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
filesize_guard:
runs-on: ubuntu-latest
steps:
- name: Filesize Guard
uses: chris-rutkowski/filesize-guard@v1.0.3Add a filesize_guard.ignore file to the root of your repository to define patterns for files or directories to exclude from size checks. The syntax follows .gitignore conventions.
Example filesize_guard.ignore:
test/*
logs/*
*.swift
*.kt
*.dartRun the action manually using the workflow_dispatch event to scan and find large files in your repository.
name: Filesize Guard
on:
workflow_dispatch:
pull_request:
...By default, the file size limit is set to 100 kB. You can customize this by passing the max_size_kb input:
steps:
- name: Filesize Guard
uses: chris-rutkowski/filesize-guard@v1.0.3
with:
max_size_kb: 50steps:
- name: Filesize Guard
uses: chris-rutkowski/filesize-guard@v1.0.3
with:
ignore_file: ./my/path/my_filesize_guard.ignoreThis project is licensed under the MIT License.