Skip to content

Add parameters for generating more flexible changesets using the add goal #97

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

Merged
merged 3 commits into from
Jun 25, 2025

Conversation

splitfeed
Copy link
Contributor

You can now create changesets with more prefilled info and with predictable names (useful for testing and dependabot).

mvn changesets:add -DchangesetLevel=patch -DchangesetContent="My change" -DchangesetFile=magic.md

@splitfeed splitfeed requested a review from magnusp as a code owner June 24, 2025 11:17
invoker.goals.3=${project.groupId}:${project.artifactId}:${project.version}:add -DchangesetContent='Major change' -DchangesetLevel=major -DchangesetFilename=major.md

# TODO Enable this goal to test the dependency change, once that PR is merged
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolve this TODO when #95 is merged

"Major change");

// See invoker.properties for the dependency change details
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Resolve this when #95 is merged

@splitfeed splitfeed requested a review from Copilot June 24, 2025 11:18
Copilot

This comment was marked as outdated.

@splitfeed splitfeed requested a review from Copilot June 25, 2025 05:58
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request adds parameters to the Maven add goal to allow generating changesets with prefilled content and predictable filenames, which is useful for testing and dependabot scenarios. Key changes include:

  • Introduction of new parameters (changesetContent, changesetLevel, changesetFilename) and their usage in AddMojo.java.
  • Updates to integration tests (verify.groovy and invoker.properties) to validate the new filename and content behavior.
  • Modifications in ChangesetWriter.java to support writing changesets with an optionally supplied file.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
changesets-maven-plugin/src/main/java/se/fortnox/changesets/maven/AddMojo.java Added new parameters and logic for flexible changeset creation
changesets-maven-plugin/src/it/add-changeset-from-property/verify.groovy Updated tests to check multiple changesets with predictable filenames
changesets-maven-plugin/src/it/add-changeset-from-property/invoker.properties Modified invoker goals to supply predictable changeset filenames
changesets-maven-plugin/pom.xml Added configuration to skip certain invocations during tests
changesets-java/src/main/java/se/fortnox/changesets/ChangesetWriter.java Refactored changeset file writing logic to accommodate custom filenames
.github/workflows/dependabot-changesets.yml Updated workflow steps and echo outputs for dependabot metadata

LOG.info("Writing changeset to {}", changesetFile);
Files.writeString(changesetFile, fileContent, StandardOpenOption.CREATE_NEW);
} catch (IOException e) {
LOG.error("Failed to create new changeset", e);
Copy link
Preview

Copilot AI Jun 25, 2025

Choose a reason for hiding this comment

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

Consider propagating the IOException (or wrapping it in a RuntimeException) to ensure that failures in writing the changeset file are not silently ignored.

Suggested change
LOG.error("Failed to create new changeset", e);
LOG.error("Failed to create new changeset", e);
throw e;

Copilot uses AI. Check for mistakes.

@splitfeed splitfeed merged commit 94f7236 into main Jun 25, 2025
7 checks passed
@splitfeed splitfeed deleted the add-level-parameter-to-add branch June 25, 2025 06:00
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.

2 participants