Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crate single unified changelog for multiple git repositories #225

Closed
mcflyhalf opened this issue Jul 14, 2023 · 6 comments
Closed

Crate single unified changelog for multiple git repositories #225

mcflyhalf opened this issue Jul 14, 2023 · 6 comments
Assignees
Labels
feature/request New feature or request help wanted Extra attention is needed

Comments

@mcflyhalf
Copy link

mcflyhalf commented Jul 14, 2023

Before writing this request, I read #13 .

Problem
I have 2 git repositories core_repo and plugins_repo. The 2 are developed and maintained by the same team and are deployed together; therefore we would like to have only a single changelog that tracks the changes from the 2 repos. However, when I use git-cliff --unreleased --repository $CORE_REPO_DIR $PLUGINS_REPO_DIR --tag 5.1.0 I esentially get 2 changelogs, 1 after the other.

Solution
Is it possible to add a flag to unify these changelogs as though all the commits came from a single repository?
If it is easier, it would be okay to also provide a way to manipulate/merge the context(s) (it seems to me that 2 of them are generated in this case) before they are passed to the templating engine.

Additional context
Here is an example to demonstrate this practically
Within repo1

git log
feat: feature 1 in repo 1
fix: bugfix 1 in repo 1
feat: feature 2 in repo 1
fix: bugfix 2 in repo 1

Within repo2

git log
feat: feature 1 in repo 2
fix: bugfix 1 in repo 2
feat: feature 2 in repo 2
fix: bugfix 2 in repo 2

When I run git-cliff --unreleased --repository $REPO1_DIR $REPO2_DIR --tag 1.0.1, the output looks like

# Changelog

All notable changes to this project will be documented in this file.

## [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 1
-  Bugfix 2 in repo 1

### Features

- Feature 1 in repo 1
- Feature 2 in repo 1

## [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 2
-  Bugfix 2 in repo 2

### Features

- Feature 1 in repo 2
- Feature 2 in repo 2

<!-- generated by git-cliff -->

I am instead asking for a way to unify these into:

# Changelog

All notable changes to this project will be documented in this file.

## [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 1
- Bugfix 2 in repo 1
- Bugfix 1 in repo 2
- Bugfix 2 in repo 2

### Features

- Feature 1 in repo 1
- Feature 2 in repo 1
- Feature 1 in repo 2
- Feature 2 in repo 2

<!-- generated by git-cliff -->

I would have been happy to submit a PR but unfortunately I have never used Rust before (and cannot find a Python tool that is both well documented and flexible).

@mcflyhalf mcflyhalf added the feature/request New feature or request label Jul 14, 2023
@welcome
Copy link

welcome bot commented Jul 14, 2023

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

@orhun orhun added help wanted Extra attention is needed good first issue Good for newcomers labels Oct 10, 2023
@orhun
Copy link
Owner

orhun commented Dec 27, 2023

Hello, sorry for the late reply. 🙈

Currently git-cliff processes the releases of the given repositories separately thus the problem with the unified approach is that release metadata changes for the same release. For example, you might have tagged v0.1.0 for both repositories but the release commit/timestamp/previous version is different. This means that we might need to use metadata for one of the releases and discard the rest.

This is not really optimal and I can't think of another possible solution for now.

@orhun orhun removed the good first issue Good for newcomers label Jan 12, 2024
@orhun orhun closed this as completed Jan 12, 2024
@orhun orhun reopened this Jan 12, 2024
@orhun orhun closed this as not planned Won't fix, can't repro, duplicate, stale Jan 12, 2024
@muja
Copy link

muja commented Sep 2, 2024

Hi, would it at least be possible to sort the sections by tag? Currently the output is like this:

# Changelog

All notable changes to this project will be documented in this file.

## repo-1 [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 1
-  Bugfix 2 in repo 1

### Features

- Feature 1 in repo 1
- Feature 2 in repo 1

## repo-2 [1.0.2] - 2024-09-02

### Bug Fixes

- Bugfix 3 in repo 2

## repo-2 [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 2
-  Bugfix 2 in repo 2

### Features

- Feature 1 in repo 2
- Feature 2 in repo 2

<!-- generated by git-cliff -->

Instead it would be nice if the newer tags were on top:

# Changelog

All notable changes to this project will be documented in this file.

## repo-2 [1.0.2] - 2024-09-02

### Bug Fixes

- Bugfix 3 in repo 2

## repo-1 [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 1
-  Bugfix 2 in repo 1

### Features

- Feature 1 in repo 1
- Feature 2 in repo 1

## repo-2 [1.0.1] - 2023-07-14

### Bug Fixes

- Bugfix 1 in repo 2
-  Bugfix 2 in repo 2

### Features

- Feature 1 in repo 2
- Feature 2 in repo 2

<!-- generated by git-cliff -->

@orhun
Copy link
Owner

orhun commented Sep 2, 2024

@muja you can probably achieve that in the template by using the sort function.

@muja
Copy link

muja commented Sep 3, 2024

Unfortunately no, if I understand correctly the template is rendered per tag/version, so you can’t do any operations across versions.

I tried with$0 --context | jq '. | sort_by(.version)' | $0 --from-context - but that ran into #837

FYI we moved away from multi repo changelogs for now

@orhun
Copy link
Owner

orhun commented Sep 15, 2024

Ah, sorry to hear that, it might get a bit tricky to generate a changelog for multiple repositories. #837 should be straightforward to fix though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/request New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants