Skip to content

ci: fix changelog ordering for modpublisher's own tag/release publishing - #7

Merged
KP2048 merged 1 commit into
1.21.xfrom
changelog-ordering-fix
Aug 6, 2026
Merged

ci: fix changelog ordering for modpublisher's own tag/release publishing#7
KP2048 merged 1 commit into
1.21.xfrom
changelog-ordering-fix

Conversation

@KP2048

@KP2048 KP2048 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Follow-up to #6 (already merged). This commit landed on the changelog-automation branch after #6 had already merged, so it never made it into 1.21.x — re-opening it here on a fresh branch off current 1.21.x (cherry-picked cleanly, no conflicts).

modpublisher's changelog = file("CHANGELOG.md") (Archie/build.gradle.kts) reads that file straight off disk at publish time — it has no idea about git tags or PRs. release-notes.yaml (from #6) is reactive: it only generates a release's changelog entry after seeing the tag pushed, landing it via a PR that needs a human merge. If modpublisher creates the tag itself as part of the same ./gradlew publish* invocation that reads changelog, that's a hard ordering conflict (not a race — the entry structurally can't exist yet), and if that invocation runs in CI under the default GITHUB_TOKEN, the tag it creates won't even fire release-notes.yaml at all (GitHub's anti-recursion rule for that token).

Fixed by adding a generateChangelog Gradle task (Archie/build.gradle.kts) that publishCurseforge/publishModrinth/publishGitHub/publishMod all dependsOn — it regenerates CHANGELOG.md synchronously, right before any publish task reads it, with no GitHub Actions dependency at all (works locally or in CI regardless of token/trigger semantics). release-notes.yaml still owns the docs/news blog post, which has no such ordering requirement.

Since the release tag doesn't exist yet at this point, .github/scripts/generate_release_notes.py gains --range-end (defaults to --new-tag, matching the existing post-tag behavior) so a real ref like HEAD can be walked while --new-tag carries the not-yet-real intended version for display/heading purposes. --posts-dir is now optional — the Gradle task only regenerates the changelog, not the news post.

Test plan

  • Cherry-picked cleanly onto current 1.21.x (no conflicts, diff scoped to exactly the 3 intended files)
  • ./gradlew publishCurseforge/publishModrinth/publishGitHub/publishMod --dry-run re-verified against current 1.21.x tip — generateChangelog correctly ordered before each
  • :common:compileKotlin clean
  • Previously: ran ./gradlew generateChangelog for real once to verify end-to-end (see ci: automated changelog + release-notes blog post on tag #6's history), then reverted the resulting CHANGELOG.md

🤖 Generated with Claude Code

modpublisher's `changelog = file("CHANGELOG.md")` (Archie/build.gradle.kts)
reads that file straight off disk at publish time - it has no idea about git
tags or PRs. release-notes.yaml is reactive: it only generates a release's
changelog entry *after* seeing its tag pushed, landing it via a PR that needs
a human merge. If modpublisher creates the tag as part of the same
`./gradlew publish*` invocation that reads `changelog`, that's a hard
ordering conflict, not a race that sometimes loses - the entry can't exist
yet. And if that invocation runs in CI under the default GITHUB_TOKEN, the
tag it creates won't even fire release-notes.yaml at all, per GitHub's
anti-recursion rule for that token.

Adds a `generateChangelog` Gradle task that runs generate_release_notes.py
synchronously, writing Archie/CHANGELOG.md right before any publish task
reads it - `publishCurseforge`/`publishModrinth`/`publishGitHub`/`publishMod`
all now `dependsOn` it. No GitHub Actions dependency, so it works locally or
in CI regardless of token/trigger semantics.

Since the release tag doesn't exist yet at this point, the script gains
`--range-end` (defaults to `--new-tag`, matching the existing post-tag
behavior) so a real ref like HEAD can be walked while `--new-tag` carries the
not-yet-real intended version for display/heading purposes. `--posts-dir` is
now optional - the Gradle task only regenerates the changelog, not the news
post, which has no such ordering requirement and stays release-notes.yaml's
job.

Verified via `./gradlew publishCurseforge/publishModrinth/publishGitHub/
publishMod --dry-run` (generateChangelog appears once, correctly ordered
before each) and a real `./gradlew generateChangelog` run against this
repo's actual full history (no tag exists yet, so it exercised the
root-commit fallback too) - reverted the resulting CHANGELOG.md back to its
stub afterward since that was a verification run, not a real release.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@KP2048
KP2048 marked this pull request as ready for review August 6, 2026 21:38
Copilot AI lite review requested due to automatic review settings August 6, 2026 21:38

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@KP2048
KP2048 merged commit 76b974a into 1.21.x Aug 6, 2026
@KP2048
KP2048 deleted the changelog-ordering-fix branch August 6, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants