fix: stop submitting the whole ever-growing CHANGELOG.md as the Modrinth version body - #20
Merged
Merged
Conversation
…nth version body
publishModrinth started failing with:
EndpointException(error=invalid_input, description=Error while
validating input: Field version_body failed validation with error: length)
publisher { changelog = file("CHANGELOG.md") } submits that file's entire
content as the version body on every publish. generate_release_notes.py's
update_changelog() only ever prepends - CHANGELOG.md accumulates every
release's notes forever, and Modrinth's version_body has a length limit
(~65536 chars) that a large enough cumulative history eventually exceeds
(CurseForge tolerated it; Modrinth didn't).
A second, related bug made this worse in practice: the pre-publish flow
(generateChangelog) passes --new-tag as the *intended*, not-yet-real
version - retrying a failed local publish re-runs it with the exact same
range/version and got a fresh duplicate section prepended every time
instead of regenerating the existing one in place.
Fixes:
- generate_release_notes.py: update_changelog() now replaces the existing
top section instead of prepending a duplicate when it's for the same
version already at the top of the file (safe/correct for the real
post-tag flow too, where each version is genuinely only ever generated
once).
- New --latest-path: writes just this release's own rendered body (no
accumulated history), completely independent of whatever's already in
CHANGELOG.md.
- build.gradle.kts: generateChangelog now also writes
build/latest-changelog.md; publisher.changelog points there instead of
CHANGELOG.md.
Verified: a single generated release covering this repo's entire history
(66 entries, worst case - no previous tag) renders to ~11KB, comfortably
under Modrinth's limit. Re-running the script twice for the same version
now leaves exactly one section in CHANGELOG.md instead of two.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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
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
`publishModrinth` was failing with:
`publisher { changelog = file("CHANGELOG.md") }` submits that file's entire content as the version body on every publish. `generate_release_notes.py`'s `update_changelog()` only ever prepends - CHANGELOG.md accumulates every release's notes forever, and Modrinth's `version_body` has a length limit (~65536 chars) that a large enough cumulative history eventually exceeds. CurseForge tolerated the same payload; Modrinth didn't.
A second, related bug made this worse in practice: the pre-publish flow (`generateChangelog`) passes `--new-tag` as the intended, not-yet-real version. Retrying a failed local publish re-runs it with the exact same range/version and got a fresh duplicate section prepended every single time instead of regenerating the existing one in place - which is exactly how a local CHANGELOG.md ends up with the same version's section repeated many times over.
Fixes
Verification
A single generated release covering this repo's entire history (66 entries, worst case - no previous tag) renders to ~11KB, comfortably under Modrinth's limit. Re-running the script twice for the same version now leaves exactly one section in CHANGELOG.md instead of two.
🤖 Generated with Claude Code