-
-
Notifications
You must be signed in to change notification settings - Fork 8
Add git commit fallback for repositories without changelog files #116
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
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Adds fallback to generate changelog from git commits when no changelog.md exists - Refactors code into separate functions for better maintainability: - Get-ChangelogFromCommits: Generate changelog from git log - Get-ChangelogFromDiff: Generate changelog from file diff - Format-ChangelogContent: Apply consistent formatting and sanitization - Filters out version tag commits to focus on meaningful changes - Applies same link formatting to prevent GitHub notifications - Supports repositories like Catch2, React, Vue.js that use GitHub releases - Maintains backward compatibility with existing changelog.md workflow - Adds comprehensive tests for new functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
|
- Update git commit fallback tests to match exact expected output like other tests - Remove redundant $prefix variable definition (use global scope) - Add changelog entry for the new git commit fallback feature 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
@sentry review |
- Add comprehensive error handling for all git operations to prevent script termination - Implement progressive fallback: shallow clone → deep clone → full clone - Add proper cleanup in exception scenarios using try/catch/finally blocks - Make tests more robust to reduce external dependency brittleness - Add test for invalid repository error handling - Improve error messages with specific exit codes - Ensure temporary repository directories are always cleaned up Addresses review comments: - Fix PSNativeCommandErrorActionPreference termination issue - Handle git command failures gracefully - Improve git clone depth handling - Add better directory cleanup - Make tests less dependent on external repository state 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
Thank you for the detailed review! I've addressed all the feedback: ✅ Fixed Issues:🔴 Critical Error Handling
🟡 Robustness Improvements
🧪 Test Reliability
🔧 Key Changes Made:# Before: Could cause script termination
git clone --depth=200 $repoUrl $repoDir
# After: Proper error handling with fallbacks
$cloneResult = & {
$ErrorActionPreference = 'Continue'
try {
git clone --depth=200 $repoUrl $repoDir
# + progressive fallback logic
} finally {
$ErrorActionPreference = $oldErrorActionPreference
}
}The implementation now handles all error scenarios gracefully while maintaining the performance benefits of shallow clones when possible. All CI tests continue to pass ✅ |
…ionPreference Instead of wrapping every git command with complex error handling, simply set PSNativeCommandErrorActionPreference to false and handle $LASTEXITCODE explicitly. This is much cleaner and more maintainable: - Removes 50+ lines of complex error handling wrappers - Makes the code more readable and easier to understand - Still maintains all the same error handling behavior - All tests continue to pass Changes: - Set PSNativeCommandErrorActionPreference = $false globally - Simplified git clone/fetch/log operations to check $LASTEXITCODE directly - Removed complex try/catch/finally wrappers from Get-ChangelogFromCommits - Simplified Get-ChangelogFromDiff git diff operation - Maintained all progressive fallback and cleanup logic 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Refactored git commit fallback test cases to follow the same pattern as 'supports cross-repo links' test using single expected multiline strings instead of multiple Should-Match assertions. Changes: - 'falls back to git commits when no changelog files exist': Now uses exact expected output - 'git commit fallback handles PR references correctly': Uses exact expected output - 'git commit fallback filters out version tag commits': Uses exact expected output with full commit list Benefits: - More consistent test style across the test suite - Easier to see what the expected output should be - Better failure messages when tests fail - All 16 tests continue to pass 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Cleaned up the main logic by encapsulating changelog file fetching within the Get-ChangelogFromDiff function itself. Changes: - Get-ChangelogFromDiff now takes (oldTag, newTag, tmpDir) instead of file paths - Function handles its own changelog file fetching and returns null if files don't exist - Main logic is simplified to just call both functions and use whichever succeeds - Removes duplicate code and makes the interface cleaner - All 16 tests continue to pass Benefits: - Cleaner separation of concerns - Simpler main logic flow - Each function is more self-contained - Easier to understand and maintain 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Change test from sentry-javascript to github-workflows repo to reduce git clone timeout from 26s to 4s. The github-workflows repo is already used in other tests and clones much faster while still testing the same error handling functionality for invalid tags. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
Contributor
Author
|
@sentry review |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Details
This PR enhances the
get-changelog.ps1script to work with GitHub repositories that don't maintain a traditionalCHANGELOG.mdfile (like Catch2).Key Changes:
Get-ChangelogFromCommits: Generate changelog from git logGet-ChangelogFromDiff: Generate changelog from file diff (existing logic)Format-ChangelogContent: Apply consistent formatting and sanitizationExample Output:
For repositories without changelog files, the output now looks like:
Test plan
🤖 Generated with Claude Code