Duplicate Guard is a lightweight GitHub Action designed to prevent duplicate files from being added or modified in a repository. This helps reduce repository bloat, minimize downloadable app sizes, and optimize asset management. Duplicate files can significantly increase the size of compressed artifacts (such as ZIP files) because they are not optimized against themselves during compression. This action ensures your repository remains clean and efficient by detecting and blocking redundant files.
- Detects and blocks unintentionally duplicated files in pull requests.
- Helps reduce downloadable app sizes by eliminating redundant assets.
- Supports .gitignore-like syntax to exclude specific files or directories.
Create a GitHub Actions workflow in .github/workflows/duplicate_guard.yml
:
name: Duplicate Guard
on:
pull_request:
branches:
- main
workflow_dispatch:
jobs:
duplicate_guard:
runs-on: ubuntu-latest
steps:
- name: Duplicate Guard
uses: chris-rutkowski/[email protected]
Add a duplicate_guard.ignore
file to the root of your repository to define patterns for files or directories to exclude from duplicate checks. The syntax follows .gitignore
conventions.
Example duplicate_guard.ignore
:
test/*
logs/*
*.log
Run the action manually using the workflow_dispatch
event to scan and find duplicates in your repository.
name: Duplicate Guard
on:
workflow_dispatch:
pull_request:
...
steps:
- name: Duplicate Guard
uses: chris-rutkowski/[email protected]
with:
ignore_file: ./my/path/my_duplicate_guard.ignore
This project is licensed under the MIT License.