Skip to content

Create CLI applications to create minor branches#16

Open
sdelamo wants to merge 2 commits into
mainfrom
minor-branch
Open

Create CLI applications to create minor branches#16
sdelamo wants to merge 2 commits into
mainfrom
minor-branch

Conversation

@sdelamo
Copy link
Copy Markdown
Member

@sdelamo sdelamo commented May 20, 2026

After a minor or major release of micronaut we should create new minor branches for every repository and set those as default branches. This PR adds a CLI that we can invoke to to that.

java -jar build/libs/minor-branch-creator-0.1-all.jar --github-token=xxxx --dry-run --url=https://github.com/micronaut-projects/micronaut-platform/blob/5.0.x/gradle/libs.versions.toml

This will be an example of the output for dry-run

Repositories: 75

Repository: micronaut-projects/micronaut-elasticsearch
Current default branch: 6.0.x
Resolved platform version: 6.0.0
Target minor branch: 6.1.x
Mode: dry run
Branch: would be created
Default branch: would be updated
Create branch action: refs/heads/6.1.x from 6.0.x
Set default branch action: 6.1.x

Repository: micronaut-projects/micronaut-jmx
Current default branch: 5.0.x
Resolved platform version: 5.0.0
Target minor branch: 5.1.x
Mode: dry run
Branch: would be created
Default branch: would be updated
Create branch action: refs/heads/5.1.x from 5.0.x
Set default branch action: 5.1.x

Repository: micronaut-projects/micronaut-micrometer
Current default branch: 6.0.x
Resolved platform version: 6.0.0
Target minor branch: 6.1.x
Mode: dry run
Branch: would be created
Default branch: would be updated
Create branch action: refs/heads/6.1.x from 6.0.x
Set default branch action: 6.1.x

Repository: micronaut-projects/micronaut-opensearch
Current default branch: 2.0.x
Resolved platform version: 2.0.0
Target minor branch: 2.1.x
Mode: dry run
Branch: would be created
Default branch: would be updated
Create branch action: refs/heads/2.1.x from 2.0.x
Set default branch action: 2.1.x

Copy link
Copy Markdown

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

Adds a new Micronaut/Picocli-based CLI tool (minor-branch-creator) intended to automate creation of the next Micronaut minor maintenance branch across repositories and optionally set it as the default branch.

Changes:

  • Introduces a new CLI command that reads a platform libs.versions.toml, derives the next X.(Y+1).x branch, creates it, and optionally updates the repo default branch (with --dry-run support).
  • Adds GitHub API client logic (refs, default branch updates, GitHub “contents” fetch for blob URLs) plus TOML parsing/version resolution.
  • Adds tests for configuration binding and core CLI/branching behavior.

Reviewed changes

Copilot reviewed 14 out of 15 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
minor-branch-creator/src/main/java/minor/branch/creator/MinorBranchCreatorCommand.java Implements the CLI command, branching logic, GitHub API client, URL parsing, and TOML/version parsing helpers.
minor-branch-creator/src/main/java/minor/branch/creator/GitHubOrgConfiguration.java Adds configuration binding for githuborg.repos with quote-stripping/sanitization.
minor-branch-creator/src/main/resources/application.properties Provides default configured repository list for batch operation.
minor-branch-creator/src/main/resources/logback.xml Configures console logging for the CLI.
minor-branch-creator/src/test/java/minor/branch/creator/MinorBranchCreatorCommandTest.java Adds unit tests covering CLI execution paths, dry-run behavior, URL parsing, and TOML parsing.
minor-branch-creator/src/test/java/minor/branch/creator/GitHubOrgConfigurationTest.java Adds Micronaut test validating repository configuration is loaded.
minor-branch-creator/build.gradle.kts Defines Gradle build, dependencies, Java compatibility, and Dockerfile base image settings.
minor-branch-creator/settings.gradle.kts Declares the Gradle project name.
minor-branch-creator/gradle.properties Pins the Micronaut version used by the module.
minor-branch-creator/gradle/wrapper/gradle-wrapper.properties Adds Gradle wrapper distribution configuration for the module.
minor-branch-creator/gradlew Adds Gradle wrapper startup script (POSIX).
minor-branch-creator/gradlew.bat Adds Gradle wrapper startup script (Windows).
minor-branch-creator/micronaut-cli.yml Micronaut CLI scaffold metadata for the module.
minor-branch-creator/README.md Adds usage documentation (currently includes template Micronaut docs content).
minor-branch-creator/.gitignore Adds module-local ignore rules.
Comments suppressed due to low confidence (1)

minor-branch-creator/src/main/resources/application.properties:72

  • githuborg.repos includes multiple duplicates in the tail of the list (e.g., micronaut-data, micronaut-security, micronaut-graphql, micronaut-spring, micronaut-kafka, micronaut-openapi). This will cause the CLI to process the same repo multiple times in one run. Please remove duplicates (or ensure the command de-duplicates configured repos before iterating).
githuborg.repos[63]='micronaut-test-resources'
githuborg.repos[64]='micronaut-control-panel'
githuborg.repos[65]='micronaut-data'
githuborg.repos[66]='micronaut-security'
githuborg.repos[67]='micronaut-graphql'
githuborg.repos[68]='micronaut-spring'
githuborg.repos[69]='micronaut-kafka'
githuborg.repos[70]='micronaut-openapi'

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +45 to +49
githuborg.repos[43]='micronaut-mqtt'
githuborg.repos[44]='micronaut-nats'
githuborg.repos[45]='micronaut-pulsar'
githuborg.repos[46]='micronaut-rabbitmq'
githuborg.repos[47]='micronaut-acme'
Comment on lines +2 to +37
githuborg.repos[0]=micronaut-elasticsearch'
githuborg.repos[1]=micronaut-jmx'
githuborg.repos[2]=micronaut-micrometer'
githuborg.repos[3]='micronaut-opensearch'
githuborg.repos[4]='micronaut-graphql'
githuborg.repos[5]='micronaut-grpc'
githuborg.repos[6]='micronaut-guice'
githuborg.repos[7]='micronaut-jackson-xml'
githuborg.repos[8]='micronaut-jaxrs'
githuborg.repos[9]='micronaut-json-schema'
githuborg.repos[10]='micronaut-openapi'
githuborg.repos[11]='micronaut-serialization'
githuborg.repos[12]='micronaut-servlet'
githuborg.repos[13]='micronaut-spring'
githuborg.repos[14]='micronaut-aot'
githuborg.repos[15]='micronaut-sourcegen'
githuborg.repos[16]='micronaut-openrewrite'
githuborg.repos[17]='micronaut-aws'
githuborg.repos[18]='micronaut-azure'
githuborg.repos[19]='micronaut-object-storage'
githuborg.repos[20]='micronaut-discovery-client'
githuborg.repos[21]='micronaut-gcp'
githuborg.repos[22]='micronaut-kubernetes'
githuborg.repos[23]='micronaut-oracle-cloud'
githuborg.repos[24]='micronaut-pulsar'
githuborg.repos[25]='micronaut-tracing'
githuborg.repos[26]='micronaut-toml'
githuborg.repos[27]='micronaut-logging'
githuborg.repos[28]='micronaut-data'
githuborg.repos[29]='micronaut-cassandra'
githuborg.repos[30]='micronaut-coherence'
githuborg.repos[31]='micronaut-eclipsestore'
githuborg.repos[32]='micronaut-mongodb'
githuborg.repos[33]='micronaut-neo4j'
githuborg.repos[34]='micronaut-r2dbc'
githuborg.repos[35]='micronaut-redis'
Comment on lines +32 to +35

graalvmNative {
binaries {
all {
Comment on lines +1 to +4
## Micronaut 5.0.0-RC1 Documentation

## Usage

@@ -0,0 +1,76 @@
micronaut.application.name=minor-branch-creator
githuborg.repos[0]=micronaut-elasticsearch'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

why is this needed? this is another thing to maintain when a new repo is created

Copy link
Copy Markdown
Member

@alvarosanchez alvarosanchez left a comment

Choose a reason for hiding this comment

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

The idea is very useful, but parsing the TOML is a bit brute force.

Ideally, the way to use this should be to pass a version string, and then the CLI reads the corresponding BOM and uses a resolution API (eg Maven Resolver) to figure out versions.

In any case I expect this to be run from a manually triggered GitHub actions workflow

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