-
Notifications
You must be signed in to change notification settings - Fork 0
🔧 Improve pre-push error message for PR size violations #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
SPDX-FileCopyrightText: 2025 SecPal SPDX-License-Identifier: MIT Syncs CHANGELOG validation logic from api repo (PR #77) to contracts. Changes: - Validates [Unreleased] section exists on feature/fix/refactor branches - Checks for minimum content (MIN_CHANGELOG_LINES=3) - Exempts docs/*, chore/*, ci/*, test/* branches - Robust parsing handles [Unreleased] as last section (edge case fix) - Uses configurable variables for maintainability Context: Multi-repo script synchronization initiative. Ensures consistent CHANGELOG policy enforcement across all SecPal repos. Benefits: - ✅ Prevents "forgot to update CHANGELOG" PR comments - ✅ Catches empty [Unreleased] sections (copy-paste artifacts) - ✅ Smart exemptions for docs-only branches - ✅ Early feedback (local preflight vs CI failure) Related: - api #77: Original CHANGELOG validation implementation - frontend #55: Parallel sync to frontend repo - .github #168: Template documentation
…s, MIN_CHANGELOG_LINES) - Replace bash-specific [[ =~ ]] with POSIX case statement for portability - Use grep -nE for robust [Unreleased] matching (supports Keep a Changelog links) - Extract duplicated grep chains to filter_changelog_content() with whitespace tolerance - Clarify MIN_CHANGELOG_LINES comment about what is counted (substantive content only) Addresses all 4 Copilot review comments on PR #39
Same fix as SecPal/api#81 - enhanced error message clarity with: - Visual separators for attention - Exact breakdown (insertions + deletions) - Numbered options for bypass - Clear "Push aborted" message See SecPal/api#80 for problem description
💡 Tip: Consider Using Draft PRsBenefits of opening PRs as drafts initially:
How to convert:
This is just a friendly reminder - feel free to continue as is! 😊 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR enhances the preflight.sh script with two key improvements: CHANGELOG validation for feature branches and improved error messaging for large PRs.
Key Changes:
- Adds automated CHANGELOG.md validation that enforces non-empty
[Unreleased]sections for feature/fix/refactor branches (exempts docs/chore/ci/test branches) - Refactors PR size check to display separate insertion/deletion counts with a detailed, formatted error message
- Combine multiple grep -Ev calls into single grep with pattern group - Use grep -m 1 for early termination (performance improvement) - Fix sed range calculation (UNRELEASED_END is relative, not absolute) - Add clarifying comments about CHANGELOG_EXEMPT_PREFIXES and case sync - Improve warning message with specific line count and non-blocking note Addresses Copilot review comments in PR #40
…om/SecPal/contracts into fix/improve-preflight-error-messages
💡 Tip: Consider Using Draft PRsBenefits of opening PRs as drafts initially:
How to convert:
This is just a friendly reminder - feel free to continue as is! 😊 |
Problem
Same issue as described in SecPal/api#80 - pre-push hook error messages for PR size violations were unclear.
Solution
Enhanced error message with clear visual structure (see SecPal/api#81 for example output).
Changes
Related: SecPal/api#80, SecPal/api#81