Commit 1dbbc41
Add git commit fallback for repositories without changelog files (#116)
* feat: add git commit fallback for repositories without changelog files
- 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>
* refactor: improve tests and remove redundant code
- 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>
* fix: address review feedback on error handling and robustness
- 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>
* fix: reorder features section in changelog for clarity
* refactor: simplify error handling by changing PSNativeCommandErrorActionPreference
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>
* refactor: remove unused variable for test cases in update-changelog tests
* fix: improve cloning process by removing unnecessary depth adjustments
* test: improve test cases to use single expected multiline strings
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>
* refactor: move changelog fetching into Get-ChangelogFromDiff function
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>
* fix: streamline cloning process by removing fallback for shallow clone
* test: update changelog tests to use new repository and tag references
* perf: optimize missing versions test by using existing repo
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>
* fix: remove unnecessary redirection in git log command for commit messages
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent 6af5c2d commit 1dbbc41
File tree
4 files changed
+309
-74
lines changed- updater
- scripts
- tests
4 files changed
+309
-74
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
49 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
50 | 51 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
56 | 126 | | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
57 | 136 | | |
58 | | - | |
59 | 137 | | |
60 | | - | |
61 | | - | |
62 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
63 | 143 | | |
64 | 144 | | |
65 | | - | |
| 145 | + | |
66 | 146 | | |
67 | 147 | | |
68 | 148 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 149 | + | |
79 | 150 | | |
80 | 151 | | |
81 | 152 | | |
82 | 153 | | |
83 | | - | |
84 | | - | |
| 154 | + | |
| 155 | + | |
85 | 156 | | |
86 | 157 | | |
87 | 158 | | |
88 | 159 | | |
89 | 160 | | |
90 | 161 | | |
91 | 162 | | |
92 | | - | |
93 | | - | |
94 | | - | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
95 | 167 | | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 168 | + | |
| 169 | + | |
102 | 170 | | |
103 | | - | |
104 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
105 | 174 | | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
114 | 179 | | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
139 | 209 | | |
140 | | - | |
141 | | - | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
142 | 226 | | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
143 | 246 | | |
144 | 247 | | |
145 | | - | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
146 | 259 | | |
147 | 260 | | |
148 | 261 | | |
| |||
0 commit comments