Skip to content

Add template option to changelog-github - #2059

Merged
bluwy merged 14 commits into
changesets:mainfrom
jycouet:compact-next
Jun 26, 2026
Merged

Add template option to changelog-github#2059
bluwy merged 14 commits into
changesets:mainfrom
jycouet:compact-next

Conversation

@jycouet

@jycouet jycouet commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Reproduces @svitejs/changesets-changelog-github-compact (unmaintained) without the dependency.

Summary

Opt-in template option for @changesets/changelog-github. It lets it render compact changelog lines straight from .changeset/config.json. With template unset, output is byte-for-byte unchanged.

Reproduce the compact look:

"changelog": ["@changesets/changelog-github", {
  "repo": "<org>/<repo>",
  "template": "\n- {summary} {ref}"
}]

Tokens render bare (you write the surrounding spaces; empties self-erase and trailing whitespace is trimmed):

  • {summary} - first line, links every #n
  • {ref} - PR-xor-commit, parenthesized
  • {pr}, {commit} - the bare links
  • {authors} - contributor links (honors disableThanks); write the prefix yourself, e.g. Thanks {authors}!

Examples: template/output pairs live in the package README, each locked by a test so they can't drift.

Decisions

  1. disableThanks stays. It is not deprecated and keeps working in template mode ({authors} honors it; you can also drop attribution by omitting {authors}). No back-compat break.
  2. This stays in @changesets/changelog-github for now. Lifting templating into core (so every generator just contributes variables like {pr} / {commit} / {authors}) is a follow-up, not this PR. buildReleaseLineTokens is already shaped for that role and can move up later.

Potentially relevant issues / PRs

Refs are intentionally in backticks so this draft creates no cross-links.

Fully addressed

  • #538 - clickable issue links in CHANGELOG.md -> {summary}
  • #689 - dropping the "Thanks X" noise for solo maintainers -> omit {authors} / disableThanks
  • #1596 - customizing the per-release-line message -> template

Partially addressed (done / not done)

  • #1821 - templates: DONE = output changelog-line template; NOT = input changeset-file template (changeset add --template)
  • #1178 - modify the changelog format: DONE = per-line formatting; NOT = whole-file grouping / headers
  • #1057 - omit lines: DONE = per-line pieces (Thanks / PR / commit); NOT = removing section headers like "Patch Changes"
  • #1635 - shorter commit hash: DONE = changelog {commit} / {ref} (7-char); NOT = the snapshot prerelease version string
  • #1959 - override the default changelog formatter: DONE = per-line tokens; NOT = arbitrary PR tags / extra per-record metadata
  • #1248 - username links: DONE = drop attribution via {authors} / disableThanks; NOT = emitting plain unlinked @user for GitHub's Contributors section

Adjacent - not solved here

These need the headers/grouping or a deeper hook in apply-release-plan, not the changelog functions:

  • #1807 - changelog section titles
  • #995 - a getChangelogEntry hook for custom generators
  • #1204 - a contributors-acknowledgement section
  • #1332 - customizing generateChangesForVersionTypeMarkdown
  • #1127 / #1123 - a getVersionLine hook (version header line)

Related context

  • #1850 (merged) added linkifyIssueRefs; {summary} reuses it
  • #1255 (merged) added disableThanks; {authors} honors it (kept, see Decisions)
  • #1236 (merged) moved away from short commit IDs after a collision bug; this PR's {commit} / {ref} render 7-char hashes to match compact - flagging in case it needs revisiting
  • #1830 (open) adds a changelog-github README; if it lands, document these options there too (currently in config-file-options.md)

Verification

@changesets/changelog-github suite 56/56, types:check / lint / format clean. Existing snapshots unchanged (the back-compat guarantee).

@changeset-bot

changeset-bot Bot commented Jun 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 15d2c2d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@changesets/changelog-github Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@codecov

codecov Bot commented Jun 6, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.18%. Comparing base (dfefc4e) to head (15d2c2d).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2059      +/-   ##
==========================================
+ Coverage   86.04%   86.18%   +0.14%     
==========================================
  Files          70       71       +1     
  Lines        2558     2585      +27     
  Branches      692      703      +11     
==========================================
+ Hits         2201     2228      +27     
  Misses        330      330              
  Partials       27       27              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pomerantsev

Copy link
Copy Markdown

It would be great to see this merged. I'd love to do less manual updating of my changelog entries for every release.

@Andarist
Andarist requested a review from bluwy June 25, 2026 06:56

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I prefer if we mark or document the template option as experimental, and recommend pinning the version if used.

Right now there's things like:

  1. If replacements like {authors} is empty, is going to leave an awkward Thanks ! rendered text. Similarly it doesn't handle conditional parenthesis and spaces.
  2. {ref} has builtin parenthesis right now so it's easier to be compatible with -compact. I don't think it should have parenthesis builtin but we can leave it as is for now if we mark as experimental.
  3. Eventually we should use renderTemplate for the default behaviour too. But it's not possible to handle the above right now without better templating syntax. So I'm ok with not doing this as well as long as it's experimental.

Comment thread packages/changelog-github/src/index.ts Outdated
Comment thread packages/changelog-github/src/index.ts Outdated
Comment thread packages/changelog-github/src/index.ts Outdated
Comment thread docs/config-file-options.md Outdated
@bluwy bluwy changed the title feat(changelog-github): add template and autolinkIssues options feat(changelog-github): add template option Jun 25, 2026

@bluwy bluwy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The base branch needs to be updated to main as well. Shouldn't have any big conflicts by directly switching.

Comment thread packages/changelog-github/src/index.test.ts Outdated
Comment thread packages/changelog-github/src/index.ts Outdated
Comment thread packages/changelog-github/src/render-template.ts Outdated
Comment thread docs/config-file-options.md Outdated
@jycouet
jycouet changed the base branch from next to main June 25, 2026 18:22
@Andarist
Andarist requested a review from bluwy June 25, 2026 20:02
@trueberryless

Copy link
Copy Markdown
Contributor

Do we need a next-docs PR for this?

@bluwy

bluwy commented Jun 26, 2026

Copy link
Copy Markdown
Member

Yeah we can do that after this is merged

@Andarist Andarist changed the title feat(changelog-github): add template option Add template option to changelog-github Jun 26, 2026
@Andarist
Andarist added this pull request to the merge queue Jun 26, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jun 26, 2026

@trueberryless trueberryless 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.

Sorry for the late review. I know you want to merge already. Just a small docs nitpick here:

Comment thread packages/changelog-github/README.md Outdated
jycouet and others added 2 commits June 26, 2026 09:58
Co-authored-by: Felix Schneider <99918022+trueberryless@users.noreply.github.com>
@jycouet

jycouet commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

@Andarist conflics fixed 👍
I updated the PR description also to reflect latest changes

Maybe you will want to link later some issues properly (from PR description?) to notify them?

@trueberryless trueberryless 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.

Amazing 😍
Everything LGTM 🚀

Thanks @jycouet for your wonderful contribution. I'm looking forward to playing around with this option!

@bluwy
bluwy added this pull request to the merge queue Jun 26, 2026
Merged via the queue into changesets:main with commit 070f531 Jun 26, 2026
12 checks passed
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.

6 participants