Skip to content

chris-rutkowski/filesize-guard

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages