Skip to content

OCM-12992 | chore: set git-cliff for handling changelog update#1075

Open
amandahla wants to merge 1 commit intoterraform-redhat:mainfrom
amandahla:OCM-12992-update-changelog
Open

OCM-12992 | chore: set git-cliff for handling changelog update#1075
amandahla wants to merge 1 commit intoterraform-redhat:mainfrom
amandahla:OCM-12992-update-changelog

Conversation

@amandahla
Copy link

@amandahla amandahla commented Mar 5, 2026

PR Summary

Actions:

  • CHANGELOG was manually updated.
  • Pushing a release tag will trigger a workflow that updates CHANGELOG.md file using git-cliff and submits a PR with label changelog. This PR should be reviewed before merged.

See an example here:
amandahla/test-actions#14

GitHub Repository Settings Requirements

  • label changelog must exist
  • Settings -> Actions -> General -> Workflow permissions -> Allow GitHub Actions to create and approve pull requests must be enabled
  • Nice to have: disable tests for PRs with label changelog

What commits will be considered

  • Commits that match the preprocessor (e.g. [TICKET] | type: message or type: message) and are not skipped.
  • Included: feat, fix, docs, perf, refactor, style, chore, messages containing “fix” or “documentation”, revert, and any other message (catch‑all → “Other”). Body containing “security” → SECURITY group.
  • Skipped (not considered): test, ci, build; messages containing “konflux” or “changelog”; chore(release), chore(deps…); single‑word messages; merge commits (Merge pull request, Merge branch, …); “Update README.md”.

Detailed Description of the Issue

We need an automated way of updating CHANGELOG during the release process.

What this PR changes

Add a GitHub workflow for automatically submitting a PR that updates CHANGELOG file in main branch.

Related Issues and PRs

  • Jira: OCM-12992
  • Fixes: N/A
  • Related PR(s): N/A
  • Related design/docs: N/A

Type of Change

  • feat - adds a new user-facing capability.
  • fix - resolves an incorrect behavior or bug.
  • docs - updates documentation only.
  • style - formatting or naming changes with no logic impact.
  • refactor - code restructuring with no behavior change.
  • test - adds or updates tests only.
  • chore - maintenance work (tooling, housekeeping, non-product code).
  • build - changes build system, packaging, or dependencies for build output.
  • ci - changes CI pipelines, jobs, or automation workflows.
  • perf - improves performance without changing intended behavior.

Previous Behavior

  • CHANGELOG.md only contained entries up to version 1.6.7, missing 7 subsequent releases.
  • No tooling or documented process for adding release notes or generating the changelog.

Behavior After This Change

GitHub workflow automatically updates the changelog file by submitting a PR.

How to Test (Step-by-Step)

Preconditions

N/A

Test Steps

N/A

Expected Results

  • CHANGELOG updated.

Proof of the Fix

N/A

Breaking Changes

  • No breaking changes
  • Yes, this PR introduces a breaking change (describe impact and migration plan below)

Breaking Change Details / Migration Plan

N/A

Developer Verification Checklist

  • Commit subject/title follows [JIRA-TICKET] | [TYPE]: <MESSAGE>.
  • PR description clearly explains both what changed and why.
  • Relevant Jira/GitHub issues and related PRs are linked.
  • Tests were added/updated where appropriate.
  • I manually tested the change.
  • make test passes.
  • make fmt passes.
  • make build passes.
  • Documentation was added/updated where appropriate.
  • Any risk, limitation, or follow-up work is documented.

@openshift-ci
Copy link

openshift-ci bot commented Mar 5, 2026

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign marcolan018 for approval. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@olucasfreitas
Copy link
Contributor

/retest-required

@amandahla amandahla changed the title OCM-12992 | chore: update changelog.md file OCM-12992 | chore: chore: set changie for handling changelog update Mar 6, 2026
@amandahla
Copy link
Author

/jira refresh

@openshift-ci-robot
Copy link

@amandahla: No Jira issue is referenced in the title of this pull request.
To reference a jira issue, add 'XYZ-NNN:' to the title of this pull request and request another refresh with /jira refresh.

Details

In response to this:

/jira refresh

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@amandahla amandahla changed the title OCM-12992 | chore: chore: set changie for handling changelog update OCM-12992: chore: chore: set changie for handling changelog update Mar 6, 2026
@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 6, 2026

@amandahla: This pull request references OCM-12992 which is a valid jira issue.

Warning: The referenced jira issue has an invalid target version for the target branch this PR targets: expected the task to target the "4.22.0" version, but no target version was set.

Details

In response to this:

PR Summary

This PRs covers 2 steps:

  1. Changelog history: The previous CHANGELOG.md has been updated and then moved to CHANGELOG.legacy.md (full history from 0.0.1 through 1.7.4). CHANGELOG.md is now a placeholder and will be populated by Changie on the next release (see CONTRIBUTE.md and make changelog-release).

  2. Changie setup: Added Changie config (.changie.yaml), .changes/ layout (including unreleased/), documentation in CONTRIBUTE.md, PR template checklist, and Makefile targets (tools, changelog-release). Future releases: add fragments under .changes/unreleased/, then run make changelog-release VERSION=x.y.z before tagging.

Detailed Description of the Issue

The CHANGELOG.md file was outdated and missing entries for 7 released versions (1.6.8, 1.6.9, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4), and there was no standard process for keeping it updated. This made it difficult for users to understand what features and fixes were included in recent releases and for contributors to add release notes consistently.

What this PR changes

Changelog process (before was manual now will be handled by Changie)

  • Contributors:
    Install Changie and use it for new changelog entries. For any user-facing change, add an entry under .changes/unreleased/ (e.g. run changie new and follow the prompts). See CONTRIBUTE.md for kinds (FEATURES, ENHANCEMENTS, BUG FIXES, BREAKING CHANGES) and examples.

  • Release owners: When cutting a new version:
    Run make changelog-release VERSION=x.y.z (this runs changie batch and changie merge and updates CHANGELOG.md).
    Commit the updated CHANGELOG.md (and any .changes/ changes).
    Push the tag (e.g. git tag vx.y.z && git push origin vx.y.z) so the release is built with the new changelog.

Related Issues and PRs

  • Jira: OCM-12992
  • Fixes: N/A
  • Related PR(s): N/A
  • Related design/docs: N/A

Type of Change

  • feat - adds a new user-facing capability.
  • fix - resolves an incorrect behavior or bug.
  • docs - updates documentation only.
  • style - formatting or naming changes with no logic impact.
  • refactor - code restructuring with no behavior change.
  • test - adds or updates tests only.
  • chore - maintenance work (tooling, housekeeping, non-product code).
  • build - changes build system, packaging, or dependencies for build output.
  • ci - changes CI pipelines, jobs, or automation workflows.
  • perf - improves performance without changing intended behavior.

Previous Behavior

  • CHANGELOG.md only contained entries up to version 1.6.7, missing 7 subsequent releases.
  • No tooling or documented process for adding release notes or generating the changelog.

Behavior After This Change

  • History: Full changelog (0.0.1–1.7.4) is preserved in CHANGELOG.legacy.md.
  • Current changelog: CHANGELOG.md is a short placeholder that explains it will be updated by Changie on the next release and points to CHANGELOG.legacy.md for past entries.
  • Automation: Changie is configured and required; contributors add entries under .changes/unreleased/, and releases use make changelog-release VERSION=x.y.z before tagging, matching practices used in other provider repos.

How to Test (Step-by-Step)

Preconditions

  • Git repository with tags v1.6.7 through v1.7.4 (or equivalent).

Test Steps

  1. Review CHANGELOG.legacy.md: confirm it contains all versions and matches the previous CHANGELOG content.
  2. Review CHANGELOG.md: confirm it is the placeholder (mentions Changie and points to legacy).
  3. Review .changie.yaml, .changes/ layout, CONTRIBUTE.md changelog section, and PR template: confirm they describe the new process.
  4. (Optional) Install Changie and run changie new to create a sample unreleased entry; run changie merge --include-unreleased "Unreleased" to confirm merge behavior.

Expected Results

  • No loss of changelog history; legacy file is complete and consistent.
  • Placeholder CHANGELOG.md is clear and points to legacy.
  • Changie config and docs are consistent and usable for the next release.

Proof of the Fix

  • Changelog history verified in CHANGELOG.legacy.md.
  • Changie setup verified by config, directory layout, and documentation.

Breaking Changes

  • No breaking changes
  • Yes, this PR introduces a breaking change (describe impact and migration plan below)

Breaking Change Details / Migration Plan

N/A

Developer Verification Checklist

  • Commit subject/title follows [JIRA-TICKET] | [TYPE]: <MESSAGE>.
  • PR description clearly explains both what changed and why.
  • Relevant Jira/GitHub issues and related PRs are linked.
  • Tests were added/updated where appropriate.
  • I manually tested the change.
  • make test passes.
  • make fmt passes.
  • make build passes.
  • Documentation was added/updated where appropriate.
  • Any risk, limitation, or follow-up work is documented.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@amandahla
Copy link
Author

amandahla commented Mar 6, 2026

/jira cherrypick OCM-12992

@openshift-ci-robot
Copy link

openshift-ci-robot commented Mar 6, 2026

@amandahla: Ignoring requests to cherry-pick non-bug issues: OCM-12992

Details

In response to this:

/jira cherrypick OCM-12992

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@amandahla amandahla changed the title OCM-12992: chore: chore: set changie for handling changelog update OCM-12992 | chore: set changie for handling changelog update Mar 6, 2026
@openshift-ci-robot
Copy link

@amandahla: No Jira issue is referenced in the title of this pull request.
To reference a jira issue, add 'XYZ-NNN:' to the title of this pull request and request another refresh with /jira refresh.

Details

In response to this:

PR Summary

This PRs covers 2 steps:

  1. Changelog history: The previous CHANGELOG.md has been updated and then moved to CHANGELOG.legacy.md (full history from 0.0.1 through 1.7.4). CHANGELOG.md is now a placeholder and will be populated by Changie on the next release (see CONTRIBUTE.md and make changelog-release).

  2. Changie setup: Added Changie config (.changie.yaml), .changes/ layout (including unreleased/), documentation in CONTRIBUTE.md, PR template checklist, and Makefile targets (tools, changelog-release). Future releases: add fragments under .changes/unreleased/, then run make changelog-release VERSION=x.y.z before tagging.

Detailed Description of the Issue

The CHANGELOG.md file was outdated and missing entries for 7 released versions (1.6.8, 1.6.9, 1.7.0, 1.7.1, 1.7.2, 1.7.3, 1.7.4), and there was no standard process for keeping it updated. This made it difficult for users to understand what features and fixes were included in recent releases and for contributors to add release notes consistently.

What this PR changes

Changelog process (before was manual now will be handled by Changie)

  • Contributors:
    Install Changie and use it for new changelog entries. For any user-facing change, add an entry under .changes/unreleased/ (e.g. run changie new and follow the prompts). See CONTRIBUTE.md for kinds (FEATURES, ENHANCEMENTS, BUG FIXES, BREAKING CHANGES) and examples.

  • Release owners: When cutting a new version:
    Run make changelog-release VERSION=x.y.z (this runs changie batch and changie merge and updates CHANGELOG.md).
    Commit the updated CHANGELOG.md (and any .changes/ changes).
    Push the tag (e.g. git tag vx.y.z && git push origin vx.y.z) so the release is built with the new changelog.

Related Issues and PRs

  • Jira: OCM-12992
  • Fixes: N/A
  • Related PR(s): N/A
  • Related design/docs: N/A

Type of Change

  • feat - adds a new user-facing capability.
  • fix - resolves an incorrect behavior or bug.
  • docs - updates documentation only.
  • style - formatting or naming changes with no logic impact.
  • refactor - code restructuring with no behavior change.
  • test - adds or updates tests only.
  • chore - maintenance work (tooling, housekeeping, non-product code).
  • build - changes build system, packaging, or dependencies for build output.
  • ci - changes CI pipelines, jobs, or automation workflows.
  • perf - improves performance without changing intended behavior.

Previous Behavior

  • CHANGELOG.md only contained entries up to version 1.6.7, missing 7 subsequent releases.
  • No tooling or documented process for adding release notes or generating the changelog.

Behavior After This Change

  • History: Full changelog (0.0.1–1.7.4) is preserved in CHANGELOG.legacy.md.
  • Current changelog: CHANGELOG.md is a short placeholder that explains it will be updated by Changie on the next release and points to CHANGELOG.legacy.md for past entries.
  • Automation: Changie is configured and required; contributors add entries under .changes/unreleased/, and releases use make changelog-release VERSION=x.y.z before tagging, matching practices used in other provider repos.

How to Test (Step-by-Step)

Preconditions

  • Git repository with tags v1.6.7 through v1.7.4 (or equivalent).

Test Steps

  1. Review CHANGELOG.legacy.md: confirm it contains all versions and matches the previous CHANGELOG content.
  2. Review CHANGELOG.md: confirm it is the placeholder (mentions Changie and points to legacy).
  3. Review .changie.yaml, .changes/ layout, CONTRIBUTE.md changelog section, and PR template: confirm they describe the new process.
  4. (Optional) Install Changie and run changie new to create a sample unreleased entry; run changie merge --include-unreleased "Unreleased" to confirm merge behavior.

Expected Results

  • No loss of changelog history; legacy file is complete and consistent.
  • Placeholder CHANGELOG.md is clear and points to legacy.
  • Changie config and docs are consistent and usable for the next release.

Proof of the Fix

  • Changelog history verified in CHANGELOG.legacy.md.
  • Changie setup verified by config, directory layout, and documentation.

Breaking Changes

  • No breaking changes
  • Yes, this PR introduces a breaking change (describe impact and migration plan below)

Breaking Change Details / Migration Plan

N/A

Developer Verification Checklist

  • Commit subject/title follows [JIRA-TICKET] | [TYPE]: <MESSAGE>.
  • PR description clearly explains both what changed and why.
  • Relevant Jira/GitHub issues and related PRs are linked.
  • Tests were added/updated where appropriate.
  • I manually tested the change.
  • make test passes.
  • make fmt passes.
  • make build passes.
  • Documentation was added/updated where appropriate.
  • Any risk, limitation, or follow-up work is documented.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the openshift-eng/jira-lifecycle-plugin repository.

@amandahla
Copy link
Author

/retest-required

1 similar comment
@amandahla
Copy link
Author

/retest-required

@amandahla amandahla force-pushed the OCM-12992-update-changelog branch 4 times, most recently from 71331aa to 7378b5f Compare March 9, 2026 13:54
@olucasfreitas
Copy link
Contributor

@amandahla

My concern is the per-PR overhead: contributors now need local changie + .changes fragments, and we end up with two changelog files (CHANGELOG.md + CHANGELOG.legacy.md).

Can we simplify this to a release-owner-only step (run once per release) and keep a single CHANGELOG.md with full history?

@amandahla
Copy link
Author

@amandahla

My concern is the per-PR overhead: contributors now need local changie + .changes fragments, and we end up with two changelog files (CHANGELOG.md + CHANGELOG.legacy.md).

Can we simplify this to a release-owner-only step (run once per release) and keep a single CHANGELOG.md with full history?

As we discussed, we are changing the goal of this task to automate changelog creation only during the release process, without adding new steps for contributors. I will validate how to use the tool git-cliff in our project to achieve that.
https://git-cliff.org/

@amandahla amandahla marked this pull request as draft March 10, 2026 13:57
@amandahla amandahla changed the title OCM-12992 | chore: set changie for handling changelog update WIP| DNM| OCM-12992 | chore: set changie for handling changelog update Mar 10, 2026
@amandahla amandahla force-pushed the OCM-12992-update-changelog branch from 7378b5f to b5ed192 Compare March 10, 2026 19:47
@amandahla
Copy link
Author

Commit failing with "fatal: Invalid revision range 8790678..b5ed192"

@amandahla amandahla marked this pull request as ready for review March 10, 2026 20:02
@amandahla amandahla changed the title WIP| DNM| OCM-12992 | chore: set changie for handling changelog update WIP| DNM| OCM-12992 | chore: set git-cliff for handling changelog update Mar 11, 2026
@olucasfreitas
Copy link
Contributor

/retest

@amandahla amandahla force-pushed the OCM-12992-update-changelog branch 2 times, most recently from 72f3c4c to ac1c8aa Compare March 11, 2026 19:51
@olucasfreitas olucasfreitas changed the title WIP| DNM| OCM-12992 | chore: set git-cliff for handling changelog update OCM-12992 | chore: set git-cliff for handling changelog update Mar 11, 2026
@amandahla amandahla force-pushed the OCM-12992-update-changelog branch 2 times, most recently from 70fc04b to 44a3cc7 Compare March 11, 2026 20:54
@amandahla amandahla force-pushed the OCM-12992-update-changelog branch 3 times, most recently from b8da85e to 0b8e287 Compare March 12, 2026 15:34

# Preprocessors to transform commit messages from our format to parseable format
# Transform: "OCM-12345 | feat: add feature" -> "feat: add feature"
# This allows commit_parsers to match on type while preserving the message
Copy link
Contributor

Choose a reason for hiding this comment

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

with the current parser/template setup, git-cliff can still skip valid Jira-formatted commits (OCM-XXXX | feat/fix/docs: ...) as “does not belong to any group”, which can silently drop user-facing entries from the generated changelog.

Could we harden commit_parsers so they match both Jira-prefixed and plain conventional commit forms directly (instead of relying only on preprocessing)?

Copy link
Author

Choose a reason for hiding this comment

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

Good point. I updated the config to capture the maximum number of commits from the full history.

My changes:

  • Show only the first line of each commit in the changelog (hide body/footer).
  • Strip OCM-NNNN: and OCM-NNNN | prefixes from messages.
  • Remove Signed-off-by: ... <...> lines from messages.
  • Skip commits that mention “konflux” or “changelog” (case-insensitive).
  • Skip single-word commit messages (e.g. “F”, “Init”).
  • Skip commits with message “Update README.md”.
  • Add fallback parsers for non-conventional messages: “fix” and “documentation” (case-insensitive) for grouping.
  • Add catch-all parser so unmatched commits go to “Other” under ENHANCEMENTS.

Copy link
Contributor

Choose a reason for hiding this comment

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

I re-ran the latest config and still found one edge case: because fix is unanchored, a docs message like docs: add prefix ... is still matched as Bug fixes (because of prefix).

Would you be open to anchoring the fix parser (for example ^fix(\(|:|\b)), and keeping broad fallback rules at the very end? I think that would keep grouping safer without losing coverage.

Copy link
Author

Choose a reason for hiding this comment

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

Good catch. I changed the regex to (?i)(^|.*\s)fix(\s|:) so will be more strict to catch only starting with fix or the word fix (case insensitive) and moved the documentation to be before the "fix" parser.

@amandahla amandahla force-pushed the OCM-12992-update-changelog branch 2 times, most recently from 1e6bf2f to 0b570fc Compare March 13, 2026 13:38
@amandahla
Copy link
Author

/retest

@amandahla amandahla force-pushed the OCM-12992-update-changelog branch from 0b570fc to 58b7437 Compare March 16, 2026 14:24
@amandahla amandahla force-pushed the OCM-12992-update-changelog branch from 58b7437 to f4df26a Compare March 16, 2026 14:43
# <!-- 1 --> entries are used to force an order
# Setting scope as a way to create subcategories
{ message = "^feat", group = "<!-- 1 -->FEATURES", default_scope="Ignore scope"},
{ message = "fix", group = "<!-- 2 -->ENHANCEMENTS", default_scope="Bug fixes"},
Copy link
Contributor

Choose a reason for hiding this comment

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

as parsers are first-match wins, because of that, messages containing fix inside another word (like prefix) can still land in Bug fixes. Could we also anchor that main fix parser, for example:

{ message = "(?i)^fix(\\(|:|\\b)", group = "<!-- 2 -->ENHANCEMENTS", default_scope = "Bug fixes" }

(and keep your broader fallback at the end)?

That should keep the same coverage while avoiding false positives.

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.

3 participants