[FEATURE]: Support of prevent increment of merged branch in GitHub workflow
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 58/100
Hướng nghiên cứu
Bắt đầu với MergeMessageVersionStrategy.cs và các bài kiểm thử RepositoryFixture, sau đó so sánh các kịch bản của GitFlowConfigurationBuilder và TrunkBasedConfigurationBuilder. Kiểm tra cách cấu hình của các strategy được biểu diễn và cách các increment của branch đã merge hiện được bật. Hoàn thành khi cả hai kịch bản acceptance của GitFlow và GitHubFlow đều tạo ra increment patch hoặc minor như mong đợi, với các bài kiểm thử bao phủ từng trường hợp.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Prerequisites
- I have written a descriptive issue title
- I have searched issues to ensure it has not already been reported
GitVersion package
GitVersion.Tool
GitVersion version
6.1.0
Operating system
N/A, Windows
What are you seeing?
The feature to increment the version when merging into a branch by using the increment of the source branch is currently supported only in the TrunkBased workflow. It would be good to have the same behavior in the GitFlow and GitHubFlow workflows as well.
Hint: Needs to be implemented probably in MergeMessageVersionStrategy. We should create a separate version strategy class to be able to enable or disable the behavior via the configuration (strategies property).
What is expected?
Scenario 1:
When merging a hotfix branch with increment patch to a main branch with increment minor, I would expect the increment to be patch and not minor in a GitFlow workflow.
Scenario 2:
When merging a feature branch with increment minor to a main branch with increment patch, I would expect the increment to be minor and not patch in a GitFlow workflow.
Steps to Reproduce
Scenario 1:
* 54 minutes ago (HEAD -> main)
|\
| A 56 minutes ago (hotfix/foo)
|/
* 58 minutes ago (tag: 1.0.0)
Scenario 2:
* 54 minutes ago (HEAD -> main)
|\
| A 56 minutes ago (feature/foo)
|/
* 58 minutes ago (tag: 1.0.0)
See RepostioryFixture Test section below for more information.
RepositoryFixture Test
[Test]
public void Given_main_with_increment_minor_and_hotfix_with_increment_patch_When_hotfix_merged_into_main_Then_increment_should_be_patch()
{
using var fixture = new EmptyRepositoryFixture("main");
var configurationBuilder = TrunkBasedConfigurationBuilder.New
.WithBranch("main", builder => builder
.WithIncrement(IncrementStrategy.Minor)
.WithDeploymentMode(DeploymentMode.ContinuousDelivery)
.WithPreventIncrementOfMergedBranch(true)
).WithBranch("hotfix", builder => builder.WithIncrement(IncrementStrategy.Patch));
fixture.MakeATaggedCommit("1.0.0");
fixture.BranchTo("hotfix/foo");
fixture.MakeACommit();
fixture.MergeTo("main");
// ✅ succeeds as expected
fixture.AssertFullSemver("1.0.1-2", configurationBuilder.Build());
}
It would be good to have the same behavior in the GitFlow and GitHubFlow workflows:
[Test]
public void Given_main_with_increment_minor_and_hotfix_with_increment_patch_When_hotfix_merged_into_main_Then_increment_should_be_patch()
{
using var fixture = new EmptyRepositoryFixture("main");
var configurationBuilder = GitFlowConfigurationBuilder.New
.WithBranch("main", builder => builder.WithIncrement(IncrementStrategy.Minor).WithPreventIncrementOfMergedBranch(true))
.WithBranch("hotfix", builder => builder.WithIncrement(IncrementStrategy.Patch));
fixture.MakeATaggedCommit("1.0.0");
fixture.BranchTo("hotfix/foo");
fixture.MakeACommit();
fixture.MergeTo("main");
// ❔ expected: "1.0.1-2"
fixture.AssertFullSemver("1.1.0-2", configurationBuilder.Build());
}
Additional acceptance criteria:
[Test]
public void Given_main_with_increment_patch_and_feature_with_increment_minor_When_feature_merged_into_main_Then_increment_should_be_minor()
{
using var fixture = new EmptyRepositoryFixture("main");
var configurationBuilder = GitFlowConfigurationBuilder.New
.WithBranch("main", builder => builder
.WithIncrement(IncrementStrategy.Patch)
.WithPreventIncrementOfMergedBranch(true)
).WithBranch("feature", builder => builder.WithIncrement(IncrementStrategy.Minor));
fixture.MakeATaggedCommit("1.0.0");
fixture.BranchTo("feature/foo");
fixture.MakeACommit();
fixture.MergeTo("main");
// ❔ expected: "1.1.0-2"
fixture.AssertFullSemver("1.0.1-2", configurationBuilder.Build());
}
Output log or link to your CI build (if appropriate).
N/A
- Ngôn ngữ chính
- C#
- Star
- 3.1k
- Fork
- 661
- Merge trung bình
- 7 giờ 4 phút
- Pull request đã merge (30 ngày)
- 77
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của GitTools/GitVersion
-
[ISSUE]: Mainline: version on main falls back to 0.0.x when a branch named in a merge message still existsCó thể đã có người làm @arturcic đã nhận 39 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
GitTools/GitVersion#5405 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
feature
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 35/100
GitTools/GitVersion#5398 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
GitTools/GitVersion#5267 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 30/100
GitTools/GitVersion#5188 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
breaking change pinned
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
GitTools/GitVersion#5137 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của GitTools/GitVersion
Issue tương tự
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
area/backend type/bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
umbraco/Umbraco-CMS#24668 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Pri3
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
MicrosoftDocs/windows-dev-docs#6205 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày