Skip to content

chore(chloggen): branch-name default, optional auto-filled PR, type/docs skip - #7368

Merged
zhxiaogg merged 1 commit into
grafana:mainfrom
zhxiaogg:chore/chloggen-tooling-improvements
Jun 3, 2026
Merged

chore(chloggen): branch-name default, optional auto-filled PR, type/docs skip#7368
zhxiaogg merged 1 commit into
grafana:mainfrom
zhxiaogg:chore/chloggen-tooling-improvements

Conversation

@zhxiaogg

@zhxiaogg zhxiaogg commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

What this PR does:

Quality-of-life improvements to the new chloggen-based changelog tooling.

  • make chlog-new defaults the entry filename to the current branch. A bare make chlog-new previously failed (the tool requires --filename but the Makefile didn't pass it); it now works as the docs describe. Override with FILENAME=.... Defaulting is refused on main/master/detached HEAD with a clear message.
  • issues is now optional. When left blank, the PR number is backfilled from the commit that added the entry file (Tempo squash-merges as ... (#1234)). Resolution happens in Go before the summary is rendered. On a release branch the file is added by the backport PR, so the backport PR number is used; set issues explicitly to pin a specific number.
  • Strict resolution. Both chlog-update and chlog-preview (--dry) fail if any entry's PR cannot be determined, listing every unresolved entry in one error — they never render or write an entry without a link. (Earlier drafts left preview lenient; it is now strict in both modes. Set issues explicitly when no PR exists, e.g. a direct-to-main commit.)
  • PRs labeled type/docs skip the required changelog check (alongside Skip Changelog, dependencies, and chore: titles).
  • New Tools Unit Tests workflow runs go test ./... for the separate tools module (tools/go.mod) on every PR, so chloggen's tests run in CI (the main unit-test jobs only cover the root module). Runs on every PR so it can be marked a required check without blocking unrelated PRs.
  • Docs/comments clarified in TEMPLATE.yaml, .chloggen/README.md, and CONTRIBUTING.md: issues holds the PR number (an issue number also works) and can be left blank.

Which issue(s) this PR fixes:

Checklist

  • Tests updated (tools/chloggen suite green; added TestBackfillIssues and update fail-path tests)
  • Documentation added
  • Changelog entry — N/A, tooling-only chore: change
@zhxiaogg
zhxiaogg force-pushed the chore/chloggen-tooling-improvements branch 5 times, most recently from e1ceec7 to eaebc7e Compare June 3, 2026 14:57
@zhxiaogg
zhxiaogg marked this pull request as ready for review June 3, 2026 15:12
Copilot AI review requested due to automatic review settings June 3, 2026 15:12

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 improves the repository’s chloggen-based changelog workflow by (a) making make chlog-new usable without extra flags, (b) allowing changelog issues to be omitted and backfilled from git history during chlog-update, and (c) updating CI/docs/templates to match the new intended behavior (including skipping changelog enforcement for type/docs PRs).

Changes:

  • Add best-effort PR-number backfill for empty issues fields using the commit that added the entry file, and fail chlog-update/chlog-preview when unresolved.
  • Improve make chlog-new to default the entry filename to the current git branch (with guardrails for main/master/detached HEAD).
  • Update docs/templates/CI: clarify issues semantics, skip changelog check for type/docs, and add a tools-module unit test workflow.

Reviewed changes

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

Show a summary per file
File Description
tools/chloggen/internal/chlog/entry.go Makes issues optional in validation; adds git-based PR backfill + missing-issues detection; tracks entry source path.
tools/chloggen/internal/chlog/entry_test.go Updates validation expectations and adds BackfillIssues unit tests; ensures test helpers populate entry.path.
tools/chloggen/cmd/validate_test.go Updates validate behavior tests to treat empty issues as valid.
tools/chloggen/cmd/update.go Performs issues backfill before rendering and errors out if unresolved (including in --dry).
tools/chloggen/cmd/update_test.go Adds tests ensuring update/dry-run fail when PR can’t be determined and that errors list all unresolved entries.
Makefile Defaults chlog-new filename to current branch and adds a safety check for non-derivable branch states.
CONTRIBUTING.md Updates contributor guidance for chloggen usage, including optional issues and new filename behavior.
.github/workflows/tools-tests.yml Adds a dedicated workflow to run unit tests for the tools/ Go module.
.github/workflows/changelog.yml Extends changelog-check skip conditions to include type/docs label.
.github/pull_request_template.md Updates checklist guidance to mention overriding the default chloggen filename.
.chloggen/TEMPLATE.yaml Clarifies that issues is optional and can be auto-filled at release time.
.chloggen/README.md Documents optional issues behavior, backfill semantics, and failure modes for update/preview.
Comments suppressed due to low confidence (1)

CONTRIBUTING.md:451

  • MEDIUM: This section recommends running make chlog-preview before pushing while also documenting that issues can be left blank. With the current chlog-preview implementation (chloggen update --dry), entries with blank issues will fail to preview until after merge/backfill (or until issues is set explicitly). It’d help to call out this constraint here so contributors don’t hit a confusing failure.
Validate and preview before pushing:

```bash
make chlog-validate
make chlog-preview
</details>

Comment thread tools/chloggen/cmd/update.go
Comment thread tools/chloggen/cmd/update.go
Comment thread .github/workflows/tools-tests.yml Outdated
zalegrala
zalegrala previously approved these changes Jun 3, 2026

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

Looks good to me.

…ocs skip

Several quality-of-life improvements to the changelog tooling:

- chlog-new now defaults the entry filename to the current branch, so a bare
  `make chlog-new` works as the docs describe. Override with FILENAME=...;
  defaulting is refused on main/master/detached HEAD with a clear message.
- The `issues` field is now optional. When left blank, `chlog-update` backfills
  the PR number from the commit that adds the entry file (Tempo squash-merges as
  "... (grafana#1234)"). Resolution happens in Go before the summary is rendered. On a
  release branch the backport PR number is used; set `issues` explicitly to pin
  a specific number.
- Both `chlog-update` and `chlog-preview` fail if any entry's PR cannot be
  determined, listing every unresolved entry in one error, so an entry is never
  rendered or written without a link.
- PRs labeled `type/docs` now skip the required changelog check.
- Added a `Tools Unit Tests` workflow that runs `go test ./...` for the separate
  tools module (tools/go.mod) on every PR, so chloggen's tests run in CI.
- Clarified TEMPLATE.yaml / README / CONTRIBUTING wording: `issues` holds the PR
  number (issue works too) and can be left blank.
@zhxiaogg
zhxiaogg force-pushed the chore/chloggen-tooling-improvements branch from eaebc7e to 0bfcb2d Compare June 3, 2026 15:27
@zhxiaogg
zhxiaogg enabled auto-merge (squash) June 3, 2026 15:41
@zhxiaogg
zhxiaogg merged commit d182bec into grafana:main Jun 3, 2026
40 of 56 checks passed
zhxiaogg added a commit to zhxiaogg/tempo that referenced this pull request Jun 3, 2026
zhxiaogg added a commit that referenced this pull request Jun 3, 2026
* chore(tools): add chloggen for changelog management (#7346)

(cherry picked from commit 90e1d17)

* chore(tools): configurable chloggen change types and required entry author (#7351)

(cherry picked from commit 2e3dabb)

* chore: adopt chloggen for changelog management (#7339)

(cherry picked from commit f3e791f)

* chore: update changelog check to include modified files (#7366)

(cherry picked from commit 57897eb)

* chore(chloggen): branch-name default, optional auto-filled PR, type/docs skip (#7368)

(cherry picked from commit d182bec)

* chore(chloggen): retarget changelog workflow to release-v2.9

Backport adaptation: the changelog workflow introduced in #7339 only runs
for PRs targeting main and uses origin/main as the diff base. Point both at
release-v2.9 so the check runs on backport PRs to this branch.

---------

Co-authored-by: Ruslan Mikhailov <195758209+ruslan-mikhailov@users.noreply.github.com>
zhxiaogg added a commit that referenced this pull request Jun 3, 2026
* chore(tools): add chloggen for changelog management (#7346)

(cherry picked from commit 90e1d17)

* chore(tools): configurable chloggen change types and required entry author (#7351)

(cherry picked from commit 2e3dabb)

* chore: adopt chloggen for changelog management (#7339)

(cherry picked from commit f3e791f)

* chore: update changelog check to include modified files (#7366)

(cherry picked from commit 57897eb)

* chore(chloggen): branch-name default, optional auto-filled PR, type/docs skip (#7368)

(cherry picked from commit d182bec)

* chore(chloggen): retarget changelog workflow to release-v2.10

Backport adaptation: the changelog workflow introduced in #7339 only runs
for PRs targeting main and uses origin/main as the diff base. Point both at
release-v2.10 so the check runs on backport PRs to this branch.

---------

Co-authored-by: Ruslan Mikhailov <195758209+ruslan-mikhailov@users.noreply.github.com>
zhxiaogg added a commit that referenced this pull request Jun 3, 2026
* chore(tools): add chloggen for changelog management (#7346)

(cherry picked from commit 90e1d17)

* chore(tools): configurable chloggen change types and required entry author (#7351)

(cherry picked from commit 2e3dabb)

* chore: adopt chloggen for changelog management (#7339)

(cherry picked from commit f3e791f)

* chore: update changelog check to include modified files (#7366)

(cherry picked from commit 57897eb)

* chore(chloggen): branch-name default, optional auto-filled PR, type/docs skip (#7368)

(cherry picked from commit d182bec)

* chore(chloggen): retarget changelog workflow to release-v3.0

Backport adaptation: the changelog workflow introduced in #7339 only runs
for PRs targeting main and uses origin/main as the diff base. Point both at
release-v3.0 so the check runs on backport PRs to this branch.

---------

Co-authored-by: Ruslan Mikhailov <195758209+ruslan-mikhailov@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants