Skip to content

ci: solution to CHANGELOG.md merge conflicts (auto-generated Next Release)#259

Open
galjos wants to merge 1 commit into
devfrom
ci/solution-changelog-merge-conflicts
Open

ci: solution to CHANGELOG.md merge conflicts (auto-generated Next Release)#259
galjos wants to merge 1 commit into
devfrom
ci/solution-changelog-merge-conflicts

Conversation

@galjos

@galjos galjos commented Jun 1, 2026

Copy link
Copy Markdown
Collaborator

@97gamjak — draft proposal to stop every PR conflicting on `CHANGELOG.md`.

Every PR currently has to edit the same `## Next Release` lines, so two open PRs always conflict on it. The fragments approach from #235 reduced the surface but contributors never adopted it (every PR since edits `CHANGELOG.md` directly). Cleaner fix: drop the per-PR requirement and let the conventional-commit prefixes the commit-msg hook already enforces drive an auto-generated section at release time via `git-cliff`.

How it works

  • `cliff.toml` maps every prefix to one of PQ's sections (Enhancements / Bug Fixes / Performance / Build / CI / Tests / Internal / Documentation) and renders each commit subject (prefix stripped) as one bullet.
  • `scripts/update_changelog.py`: if `## Next Release` is already populated, use as-is; if empty, fill from git-cliff. Legacy `changes/` fragments still folded in.
  • `.github/workflows/create-tag.yml` installs git-cliff before running the script.
  • `.github/workflows/changelog.yml` (the per-PR gate) is removed.

Keeping the section terse with many commits

`cliff.toml` drops merge / revert / `[skip changelog]` / style / chore / admin / example commits, groups the rest by section (~6 short sections instead of one wall), and deduplicates identical subjects. Each bullet is the commit subject only. The release PR still goes through review — you can hand-edit the generated section before tagging.

Seamless with current state

The script preserves the existing curated `## Next Release` bullets verbatim. v0.7.0 ships the curated content unchanged; auto-generation only kicks in for subsequent releases. Nothing skipped, deleted, or hand-selected.

Smoke-tested both paths on the actual CHANGELOG.md: curated → reordered into canonical section order and stamped; empty → git-cliff produced 7 grouped sections from commits since v0.6.4, terse and deduplicated.

Every PR currently has to edit CHANGELOG.md, so two open PRs always
conflict on the same lines as soon as one merges to dev. Drop the
per-PR requirement entirely and lean on the conventional-commit
prefixes already enforced by .githooks/commit-msg: at release time
git-cliff renders the Next Release section from commits since the
previous tag, grouped by section, deduplicated, prefix-stripped.

Seamless with the current state:
  - scripts/update_changelog.py preserves any curated Next Release
    content in CHANGELOG.md verbatim and just stamps it with the
    version. So the v0.7.0 release (next one) ships the already-
    curated bullets unchanged - nothing is skipped, deleted, or
    hand-selected.
  - For subsequent releases the section will be empty when the script
    runs, so git-cliff fills it in automatically from commit subjects.
    Maintainer can still hand-edit the generated section in the release
    PR before tagging.
  - Legacy changes/<slug>.<type>.md fragments (left over from the
    previous attempt) are still folded into the matching section, so
    nothing in flight gets lost either.

Verbosity is controlled in cliff.toml:
  - merge / revert / [skip changelog] commits are dropped,
  - style / format / chore / admin / example types are dropped,
  - commits are grouped under PQ's existing section headings so a
    20-commit release renders as ~6 short sections, not one wall,
  - identical subjects are deduplicated within a section,
  - each bullet is the commit subject only, no body.

The Check Changelog CI gate is removed. The PR template is unchanged;
contributors just write a good commit subject and the changelog
generates itself.

Smoke-tested both paths on the actual CHANGELOG.md:
  - curated path: existing ## Next Release content kept intact and
    reordered into canonical section order; legacy fragment folded in;
    section stamped as v0.7.0.
  - empty path: ## Next Release emptied, git-cliff produced 7 sections
    (Enhancements, Bug Fixes, Build, CI, Tests, ...) from the commits
    since v0.6.4, all bullets terse and grouped.
@galjos galjos added the workflow Issues in the workflow label Jun 1, 2026
@galjos galjos requested review from 97gamjak and ape33 June 1, 2026 18:58
@galjos galjos marked this pull request as ready for review June 16, 2026 13:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

workflow Issues in the workflow

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants