Skip to content

Filesize Guard

Actions
Blocks pull requests with unintentionally oversized files
v1.0.3
Latest
Star (2)

Filesize Guard

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.


🚀 Features

  • 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.

🛠️ Usage

1. Add the GitHub Action

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.3

2. Create an ignore file (optional)

Add 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
*.dart

♻️ Find existing large files

Run 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:

...

⚙️ Configuration

Change the file size limit

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: 50

Specify a custom ignore file path

steps:
  - name: Filesize Guard
    uses: chris-rutkowski/filesize-guard@v1.0.3
      with:
        ignore_file: ./my/path/my_filesize_guard.ignore

📄 License

This project is licensed under the MIT License.

Filesize Guard is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.

About

Blocks pull requests with unintentionally oversized files
v1.0.3
Latest

Filesize Guard is not certified by GitHub. It is provided by a third-party and is governed by separate terms of service, privacy policy, and support documentation.