Fix CHANGES.txt generation in snapshot and release builds#9938
Merged
tool4ever merged 1 commit intoCard-Forge:masterfrom Feb 27, 2026
Merged
Fix CHANGES.txt generation in snapshot and release builds#9938tool4ever merged 1 commit intoCard-Forge:masterfrom
tool4ever merged 1 commit intoCard-Forge:masterfrom
Conversation
PR Card-Forge#8410 moved CHANGES.txt from a committed file to dynamic generation from git history, which broke in CI shallow clones (no tags available). Fix by using the GitHub API to find the latest tag and deepening the clone to just that date. Also harden the Groovy script (.trim(), better fallback), drop invalid refs/tags/ prefix, simplify the Mustache template, and upgrade actions/checkout v3 to v4. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Author
|
Note that |
Contributor
|
that sounds fine for now |
tool4ever
approved these changes
Feb 27, 2026
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.
@tool4ever as discussed:
Problem
Before PR #8410, CHANGES.txt was a committed file in the source tree — CI shallow clones always had it regardless of whether the changelog plugin could regenerate it. PR #8410 deleted that file, moved the output to
target/, and added a Groovy script to dynamically find the latestforge-*tag. The motivation was to stop CHANGES.txt showing up as a modified file ingit statusafter every local build.This worked in development because local clones have full git history and all tags available. It broke in snapshot and release builds because CI workflows use shallow clones (
fetch-depth: 1) — they download only the latest commit for speed, not the full history. The Groovy script finds noforge-*tags in the shallow clone and falls back tofromRef=refs/tags/HEAD, an invalid git ref. The changelog plugin either errors or produces a single-entry changelog containing only the HEAD commit, instead of the full list of changes since the last release.Additionally:
The Mustache template produces noisy output. Every commit gets wrapped in
### No issueheaders because Forge doesn't configure issue tracker integration. The Java parser (TextUtil.getFormattedChangelog) already strips these, but they clutter the raw file shipped in Mac DMGs.Windows compatibility.
git tagoutput can contain\ron Windows, causing tag name matching to fail silently.Deprecated actions. Three workflows still use
actions/checkout@v3(Node 16 EOL).Changes
CI: fetch just enough history for changelog generation (4 workflow files)
Instead of switching to
fetch-depth: 0(which downloads the full 1 GB+ repo history), the workflows use the GitHub API to find the latestforge-*tag's commit date, then deepen the shallow clone to just that date withgit fetch --shallow-since. This adds ~4 MB and ~2 seconds to each build.snapshot-both-pc-android.yml— add changelog fetch stepsnapshots-pc.yml— upgrade checkout v3→v4, add changelog fetch stepmaven-publish.yml— upgrade checkout v3→v4, add changelog fetch stepsnapshots-android.yml— upgrade checkout v3→v4, add changelog fetch step (android assets include CHANGES.txt from the desktop build)Groovy script hardening (
forge-gui-desktop/pom.xml).trim()to tag names to strip\ron Windowsrefs/tags/prefix fromfromRef— bare tag names resolve correctly, and theHEADfallback no longer produces the invalid refrefs/tags/HEADSimplify Mustache template (
forge-gui-desktop/pom.xml)Remove
## {{name}}tag headers,### No issueheaders, andhasIssue/hasLinkgrouping. These were stripped byTextUtil.getFormattedChangeloganyway and added noise to the raw file.Testing done
Simulated CI by creating a shallow clone (
git clone --depth 1), then ran the GitHub API +git fetch --shallow-sinceapproach. The clone grew from 228 MB to 232 MB (+4 MB) in 1.6 seconds, theforge-2.0.10tag was fetched automatically, andmvn -pl forge-gui-desktop -am package -DskipTestsgenerated an 838-line CHANGES.txt with correct content — no##/###headers, proper commit entries with title, body, and timestamps. Also verified the Java parser (TextUtil.getFormattedChangelog) correctly extracts 20 non-merge entries from the output.Not tested in a live GitHub Actions run — the
--shallow-sincefetch was verified with thefile://protocol locally. If it behaves differently over HTTPS in CI, the Groovy script falls back gracefully (empty CHANGES.txt, no build failure).🤖 Generated with Claude Code