Skip to content

Commit 68c97c3

Browse files
committed
Merge branch 'release/1.2.0'
2 parents 3d7b479 + a7e2865 commit 68c97c3

File tree

4 files changed

+84
-4
lines changed

4 files changed

+84
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
## [1.2.0] / 2025-09-09
11+
### 🚀 New features
12+
- Added `IDoChoreWorkflow` component that can be used to work on a task using a `chore/*` branch.
13+
1014
## [1.1.0] / 2025-09-09
1115
### 🚀 New features
1216
- Improved targets ordering
@@ -287,7 +291,8 @@ So now `{MutationTestDirectory}/[{framework}]` is now changed to `{MutationTestD
287291
## [0.1.0] / 2022-10-23
288292
- Initial release
289293

290-
[Unreleased]: https://github.com/candoumbe/Pipelines/compare/1.1.0...HEAD
294+
[Unreleased]: https://github.com/candoumbe/Pipelines/compare/1.2.0...HEAD
295+
[1.2.0]: https://github.com/candoumbe/Pipelines/compare/1.1.0...1.2.0
291296
[1.1.0]: https://github.com/candoumbe/Pipelines/compare/1.0.1...1.1.0
292297
[1.0.1]: https://github.com/candoumbe/Pipelines/compare/1.0.0...1.0.1
293298
[1.0.0]: https://github.com/candoumbe/Pipelines/compare/0.13.4...1.0.0

GitVersion.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,18 @@ branches:
1212
tracks-release-branches: false
1313
is-release-branch: false
1414
pre-release-weight: 30000
15+
chore:
16+
regex: "^chore(s)?[/-](?<BranchName>.+)"
17+
mode: ContinuousDelivery
18+
label: '{BranchName}'
19+
increment: None
20+
prevent-increment:
21+
of-merged-branch: false
22+
track-merge-target: false
23+
source-branches: [ 'develop', 'feature', 'support', 'hotfix' ]
24+
tracks-release-branches: false
25+
is-release-branch: false
26+
pre-release-weight: 30000
1527
coldfix:
1628
regex: "^coldfix(es)?[/-](?<BranchName>.+)"
1729
mode: ContinuousDelivery

src/Candoumbe.Pipelines/Components/GitHub/IGitFlowWithPullRequest.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ async ValueTask IDoFeatureWorkflow.FinishFeature()
4848
string token = GitHubToken;
4949
if (!SkipConfirmation)
5050
{
51-
title = (Console.ReadLine()) switch
51+
title = Console.ReadLine() switch
5252
{
5353
{ } value when !string.IsNullOrWhiteSpace(value) => value.Trim(),
5454
_ => Title
@@ -108,7 +108,7 @@ static void DeleteLocalBranchIf(in bool condition, in string branchName, in stri
108108
(key: ConsoleKey.Y, "Delete the local branch"),
109109
(key: ConsoleKey.N, "Keep the local branch"),
110110
};
111-
111+
112112
static void GitPushToRemote()
113113
{
114114
Git($"push origin --set-upstream {GitCurrentBranch()}");
@@ -143,4 +143,4 @@ static void OpenUrl(string url)
143143
}
144144
}
145145
}
146-
}
146+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Nuke.Common;
4+
using Nuke.Common.Git;
5+
using static Nuke.Common.Tools.Git.GitTasks;
6+
using static Serilog.Log;
7+
8+
namespace Candoumbe.Pipelines.Components.Workflows;
9+
10+
/// <summary>
11+
/// Represents an interface for chore branch workflows in a Git repository.
12+
/// </summary>
13+
/// <remarks>
14+
/// This interface extends the <see cref="IWorkflow"/> interface and adds properties and methods specific to feature branch workflows.
15+
/// </remarks>
16+
public interface IDoChoreWorkflow : IDoFeatureWorkflow
17+
{
18+
/// <summary>
19+
/// Gets the prefix used to name feature branches.
20+
/// </summary>
21+
[Parameter("The name of the chore branch prefix")]
22+
public string ChoreBranchPrefix => TryGetValue(() => ChoreBranchPrefix) ?? "chore";
23+
24+
/// <summary>
25+
/// Gets the name of the branch to use when starting a new feature.
26+
/// </summary>
27+
/// <remarks>
28+
/// This property should never return <see langword="null"/>.
29+
/// </remarks>
30+
[Parameter("The name of the chore branch source")]
31+
string ChoreBranchSourceName => TryGetValue(() => ChoreBranchPrefix) ?? FeatureBranchSourceName;
32+
33+
/// <summary>
34+
/// Merges a chore branch back to <see cref="ChoreBranchSourceName"/>.
35+
/// </summary>
36+
/// <returns>A <see cref="ValueTask"/> representing the asynchronous operation.</returns>
37+
ValueTask FinishChore() => ValueTask.CompletedTask;
38+
39+
/// <summary>
40+
/// Starts a new chore development by creating the associated branch {FeatureBranchPrefix}/{{feature-name}} from {FeatureBranchSourceName}.
41+
/// </summary>
42+
/// <remarks>
43+
/// This target will instead end a feature if the current branch is a feature/* branch with no pending changes.
44+
/// </remarks>
45+
/// <returns>A <see cref="Target"/> representing the feature development.</returns>
46+
public Target Chore => _ => _
47+
.Description($"Starts a new chore development by creating the associated branch {ChoreBranchPrefix}/{{chore-name}} from {ChoreBranchSourceName}")
48+
.Requires(() => IsLocalBuild)
49+
.Requires(() => !GitRepository.IsOnFeatureBranch() || GitHasCleanWorkingCopy())
50+
.Executes(async () =>
51+
{
52+
if (!GitRepository.Branch.Like($"{ChoreBranchPrefix}/*", true) || !GitHasCleanWorkingCopy())
53+
{
54+
Information("Enter the name of the chore. It will be used as the name of the chore/branch (leave empty to exit) :");
55+
AskBranchNameAndSwitchToIt(ChoreBranchPrefix, sourceBranch: ChoreBranchSourceName);
56+
Information("Good bye !");
57+
}
58+
else
59+
{
60+
await FinishChore();
61+
}
62+
});
63+
}

0 commit comments

Comments
 (0)