feat: add shared YAML-config file size checker with tiered limits#98
feat: add shared YAML-config file size checker with tiered limits#98JacobPEvans wants to merge 5 commits intomainfrom
Conversation
Replace the blanket 500KB limit with a proper tiered system: - 5KB warning / 10KB error (default) - 10KB warning / 20KB error (extended, for CHANGELOG/README) - Per-repo overrides via .file-size.yml The reusable workflow now supports 3 priority levels: 1. Repo's own script (existing behavior preserved) 2. Shared YAML-config checker (new) 3. Inline fallback (legacy) DRY: same script runs in pre-commit hook and GH Actions. (claude)
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a robust and configurable system for enforcing file size limits across the organization. By centralizing configuration in a Highlights
Changelog
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. A file grows large, a warning rings, Then error shouts, on digital wings. With YAML's grace, and script's sharp eye, We keep our bytes beneath the sky. Footnotes
|
There was a problem hiding this comment.
Pull request overview
Adds an org-standard, YAML-configurable file-size enforcement mechanism that can run both locally (pre-commit) and in CI via the reusable _file-size workflow, with layered fallback behavior.
Changes:
- Introduces
scripts/workflows/check-file-sizes.shto enforce tiered size limits from.file-size.yml(with CI annotations). - Updates reusable workflow
.github/workflows/_file-size.ymlto prefer repo script → shared YAML-config checker → legacy inline fallback. - Adds org-wide default
.file-size.ymlplus a local pre-commit hook, and updates cspell dictionary entries.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
scripts/workflows/check-file-sizes.sh |
New YAML-driven checker script (yq/awk parsing, annotations, tiered limits). |
.github/workflows/_file-size.yml |
Adds shared-checker download path when .file-size.yml exists; keeps inline fallback. |
.file-size.yml |
Adds org default tiers, exemptions, and scan extensions. |
.pre-commit-config.yaml |
Adds local hook to run the checker on commits. |
.cspell.json |
Adds dictionary words used by the new script/comments. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review. Take the survey.
The script scans the whole repo via find and ignores positional args, so passing staged filenames is unnecessary and wasteful. (claude)
…ilure Adds --retry 3 --retry-connrefused to match _markdown-lint.yml pattern. When the shared checker download fails, emit a warning and fall through to the inline fallback instead of failing the workflow. (claude)
…tput - has_yq now only checks yq availability, not config validity - parse_config validates YAML upfront and fails fast on malformed configs - Add -r flag to yq calls for raw scalar output, preventing quoted patterns (e.g., "*.lock") from breaking glob/case matching - Fix arithmetic increment under set -e (0++ is falsy, causes early exit) - Add large repo docs to extended files list in .file-size.yml (claude)
- Drop awk fallback, require yq (available on GH Actions + Nix devShells) - Use wc -c instead of stat platform dance - Merge emit_warning/emit_error into single emit() function - Extract read_into() helper to DRY 6 identical while-read loops - Merge is_exempt/is_extended into matches_list() with nameref - Resolve CI mode once at startup, declare locals outside loop - Remove self-exemption from .file-size.yml (script now 5KB, under 10KB limit) (claude)
Summary
check-file-sizes.sh(155 lines) that reads.file-size.ymlfor tiered file size limitsChanges
scripts/workflows/check-file-sizes.shwc -c).github/workflows/_file-size.yml.file-size.yml.pre-commit-config.yamlpass_filenames: falseandalways_run: true.cspell.jsonTest plan
bash scripts/workflows/check-file-sizes.shpasses locally.file-size.ymlget YAML-config checker via reusable workflowRelated: #61