Skip to content

ci: automated changelog + release-notes blog post on tag - #6

Merged
KP2048 merged 2 commits into
1.21.xfrom
changelog-automation
Aug 6, 2026
Merged

ci: automated changelog + release-notes blog post on tag#6
KP2048 merged 2 commits into
1.21.xfrom
changelog-automation

Conversation

@KP2048

@KP2048 KP2048 commented Aug 6, 2026

Copy link
Copy Markdown
Member

Summary

Sets up automated CHANGELOG.md and docs/news blog-post generation, triggered on git tags (per discussion).

  • .github/workflows/release-notes.yaml — on pushing a tag matching v* to a N.N.x/main branch, walks the first-parent commit history since the previous tag, resolves each merged PR's real title via gh pr view (falling back to the commit subject for anything pushed directly to the branch), and groups entries by their Conventional Commits prefix. Opens a PR (doesn't push directly) updating:
    • Archie/CHANGELOG.md — new version section prepended, Keep-a-Changelog style. This is also the file Archie/build.gradle.kts's modpublisher config already expects at changelog = file("CHANGELOG.md") — it didn't exist until now.
    • Archie/docs/news/posts/<version>.md — a dated blog post using the mkdocs-material blog plugin already configured in mkdocs.yml (blog_dir: news), picked up automatically by the next docs.yaml deploy.
  • .github/workflows/pr-title-lint.yml — since the changelog is sourced from PR titles, enforces Conventional Commits on PR titles going forward (amannn/action-semantic-pull-request). Pre-adoption history and any title that doesn't parse falls into a catch-all "Other Changes" section rather than being dropped.
  • .github/scripts/generate_release_notes.py — the generator itself.
  • AGENTS.md — documents the PR-title convention and how to cut a release.

Follow-up: fixing an ordering conflict with modpublisher's own tag/release publishing

modpublisher's changelog = file("CHANGELOG.md") 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 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.

How to cut a release

git tag v1.1.0
git push origin v1.1.0

(or ./gradlew publishMod, etc., once GitHub-release publishing is actually turned on — either path now keeps CHANGELOG.md correct.)

Test plan

  • YAML syntax validated for both workflows
  • Python script compiles; both call shapes (post-tag with a real tag, pre-publish with --range-end HEAD and a not-yet-real --new-tag) verified against this repo's actual history, including the no-previous-tag root-commit fallback
  • ./gradlew publishCurseforge/publishModrinth/publishGitHub/publishMod --dry-run confirms generateChangelog is correctly ordered before each
  • Ran ./gradlew generateChangelog for real once to verify end-to-end, then reverted the resulting CHANGELOG.md (that was a verification run, not a real release)
  • Not yet exercised as a real triggered release-notes.yaml workflow (no tags exist in this repo yet) — first real tag push is the true end-to-end verification of that half

🤖 Generated with Claude Code

KP2048 and others added 2 commits August 6, 2026 15:39
On tagging a release (git tag vX.Y.Z, pushed to a N.N.x/main branch), a new
workflow walks the first-parent history since the previous tag, resolving
each merged PR's title (falling back to the commit itself for anything
pushed directly) and grouping entries by their Conventional Commits prefix
(feat/fix/perf/refactor/docs/test/build/ci/chore/style/revert, with an
"Other Changes" catch-all for anything that doesn't parse - expected for
pre-adoption history).

From that it generates/updates:
- Archie/CHANGELOG.md - the file Archie/build.gradle.kts's (currently
  debug-only) modpublisher config already expects at `changelog =
  file("CHANGELOG.md")`, which didn't exist until now.
- a dated Archie/docs/news/posts/<version>.md entry, using the mkdocs-material
  blog plugin already configured in Archie/mkdocs.yml (blog_dir: news) -
  picked up automatically by the next docs.yaml deploy.

Both land via an auto-opened PR against the tagged branch, not a direct push.

Since the changelog is sourced from PR titles, adds a PR-title lint workflow
enforcing the Conventional Commits format going forward (existing/pre-adoption
history is untouched and simply buckets into "Other Changes"). Documented the
requirement, and the release-cutting process, in AGENTS.md.

Verified .github/scripts/generate_release_notes.py end to end (dry-run and
real file output) against this repo's actual recent history, including both
a real merged-PR entry (correctly resolving its true title via `gh pr view`,
not the generic merge-commit subject) and several free-form direct commits
falling into "Other Changes" as expected.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@KP2048
KP2048 marked this pull request as ready for review August 6, 2026 19:42
Copilot AI lite review requested due to automatic review settings August 6, 2026 19:42
@KP2048
KP2048 merged commit 4fa4cca into 1.21.x Aug 6, 2026

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.

Pull request overview

This PR introduces an automated release-notes pipeline that generates a Keep-a-Changelog-style Archie/CHANGELOG.md entry and an mkdocs-material docs/news post when a version tag is pushed, and adds PR-title linting to keep changelog inputs (PR titles) Conventional-Commits-shaped.

Changes:

  • Add a tag-triggered workflow to generate changelog + news post and open a PR with those updates.
  • Add PR-title Conventional Commits enforcement via a dedicated workflow.
  • Introduce the release-notes generator script and document the convention/release flow in AGENTS.md (plus Python gitignore hygiene).

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
Archie/CHANGELOG.md Adds the initial changelog header/preamble used by the generator and build publishing.
AGENTS.md Documents PR-title Conventional Commits requirements and release-note automation behavior.
.gitignore Ignores Python bytecode/cache artifacts introduced by the new generator script.
.github/workflows/release-notes.yaml New workflow to generate changelog + blog post on tag push and open a PR.
.github/workflows/pr-title-lint.yml New workflow to enforce Conventional Commits formatting on PR titles.
.github/scripts/generate_release_notes.py Implements generation logic for changelog sections and mkdocs news posts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

id: base
run: |
git fetch origin --prune
BRANCH=$(git branch -r --contains "${{ github.sha }}" \
Comment on lines +8 to +14
on:
pull_request_target:
types:
- opened
- edited
- synchronize

Comment on lines +23 to +24
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@KP2048

KP2048 commented Aug 6, 2026

Copy link
Copy Markdown
Member Author

@copilot Fix the code for all comments in this review thread.

When a review comment includes a suggested change, apply the suggestion exactly.

Do not make changes beyond what is described in the linked review thread.

KP2048 added a commit that referenced this pull request Aug 6, 2026
…ng-fixes

fix: address unresolved Copilot review feedback from PRs #3, #5, #6
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