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

Merge unreleased applies all changes to all projects #569

Closed
TheSpyder opened this issue Oct 30, 2023 · 2 comments · Fixed by #570
Closed

Merge unreleased applies all changes to all projects #569

TheSpyder opened this issue Oct 30, 2023 · 2 comments · Fixed by #570
Labels
bug Something isn't working

Comments

@TheSpyder
Copy link
Contributor

TheSpyder commented Oct 30, 2023

Description
"merge unreleased" (#518) does not support projects correctly.

Reproduction Steps
Steps to reproduce the behavior:

  1. Set up changie with projects configured
  2. Add some unreleased changes specific to each project
  3. Run changie merge -u "unreleased"

What happened
Every changelog has all unreleased changes.

Expected behavior
Only changes specific to a project should be added as unreleased changes in that project's changelog.

Additional context
This feature is very handy for monorepos - I was about to request it before I realised it was already an option - because not all projects in the monorepo have unreleased changes at the same time. I want to verify in CI that unreleased changie files are valid, and changie batch fails on projects without changes.

Perhaps broken during #557, when merge switched from per-project to all projects.

@TheSpyder TheSpyder added the bug Something isn't working label Oct 30, 2023
@TheSpyder
Copy link
Contributor Author

Is it as simple as adding the project to the fake batch? That suggests this was broken before merge switched to all projects.

changie/cmd/merge.go

Lines 143 to 148 in 6f8dc52

// create a fake batch to write the changes
b := &Batch{
config: cfg,
writer: writer,
TemplateCache: m.TemplateCache,
}

@TheSpyder
Copy link
Contributor Author

Right idea, wrong code 😅 It's the core.GetChanges() call.

git diff
diff --git a/cmd/merge.go b/cmd/merge.go
index 95907d0..9c99447 100644
--- a/cmd/merge.go
+++ b/cmd/merge.go
@@ -127,7 +127,7 @@ func (m *Merge) mergeProject(cfg *core.Config, project, changelogPath string) er
                        nil,
                        m.ReadDir,
                        m.ReadFile,
-                       "",
+                       project,
                )
                if unrelErr != nil {
                        return unrelErr

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant