Pull Request Version Calculation Based on source branch #2818
-
I'm using mainline versioning mode where my feature branches increment by minor. In my scenario below, pull request version reflects the current version of master rather than the feature branch that the pull request is based on: master I've tried changing the increment mode for pullrequests in my gitversion.yml branch config but it just changes the increment based on master. How would I tell it to simply take its version from the calculated version of the feature branch for which the pull request was created? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
What happens if you set |
Beta Was this translation helpful? Give feedback.
-
I agree with you. In my opinion this is an unsupported feature: [Test]
public void Just_A_Test()
{
var configuration = GitFlowConfigurationBuilder.New.WithVersioningMode(VersioningMode.Mainline)
.WithBranch("main", _ => _.WithVersioningMode(VersioningMode.Mainline))
.WithBranch("feature", _ => _.WithVersioningMode(VersioningMode.Mainline).WithIncrement(IncrementStrategy.Minor))
.Build();
using EmptyRepositoryFixture fixture = new("main");
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("0.0.1", configuration);
fixture.BranchTo("feature/foo");
fixture.MakeACommit();
// ✅ succeeds as expected
fixture.AssertFullSemver("0.1.0-foo.1", configuration);
fixture.BranchTo("pull/8/merge");
// ✅ succeeds as expected
fixture.AssertFullSemver("0.1.0-PullRequest8.2", configuration);
fixture.Checkout("main");
fixture.MergeNoFF("pull/8/merge");
fixture.Repository.Branches.Remove("pull/8/merge");
// ❌ expected: 0.1.0
fixture.AssertFullSemver("0.0.2", configuration);
} |
Beta Was this translation helpful? Give feedback.
-
Hi @HHobeck / @anderson-dev , Do you know if this scenario is supported now? It knows that it is a merge coming from a feature branch: But it takes the last release version, and commits with the same base, and bumps the patch version. Thanks in advance, |
Beta Was this translation helpful? Give feedback.
Hi Vinicius.
I'm actually not sure if this scenario can be realized at all. If you take a look on the branch history then git version cannot determine where the merge is coming from:
Thus if you have such a process with PR you need to think of either changing your workflow or changing the release branch strategy:
Please see following links: