From 51468bc5f57b5b2e50ea453ef1716a83f2e5c298 Mon Sep 17 00:00:00 2001 From: litetex Date: Fri, 5 Feb 2021 18:56:15 +0100 Subject: [PATCH 1/3] Fixed ignoreprotocol so it works with github actions --- src/PullDetachedRemote/CMD/CmdOption.cs | 2 +- src/PullDetachedRemote/StartUp.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/PullDetachedRemote/CMD/CmdOption.cs b/src/PullDetachedRemote/CMD/CmdOption.cs index ae3a2ad..968182f 100644 --- a/src/PullDetachedRemote/CMD/CmdOption.cs +++ b/src/PullDetachedRemote/CMD/CmdOption.cs @@ -113,7 +113,7 @@ public class CmdOption /// /// [Option("ignoreprotocol")] - public bool IgnoreUpstreamRepoProtocolInOriginUpdateBranch { get; set; } + public string IgnoreUpstreamRepoProtocolInOriginUpdateBranch { get; set; } /// /// diff --git a/src/PullDetachedRemote/StartUp.cs b/src/PullDetachedRemote/StartUp.cs index 4e9ac9e..81ee33c 100644 --- a/src/PullDetachedRemote/StartUp.cs +++ b/src/PullDetachedRemote/StartUp.cs @@ -112,7 +112,7 @@ protected void ReadCMDConfig() cps.SetString(() => CmdOption.OriginBranch, v => Config.OriginBranch = v, nameof(Config.OriginBranch)); cps.SetString(() => CmdOption.UpstreamRepo, v => Config.UpstreamRepo = v, nameof(Config.UpstreamRepo)); cps.SetString(() => CmdOption.UpstreamBranch, v => Config.UpstreamBranch = v, nameof(Config.UpstreamBranch)); - cps.Set(() => CmdOption.IgnoreUpstreamRepoProtocolInOriginUpdateBranch, v => Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch = v, nameof(Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch)); + cps.SetBool(() => CmdOption.IgnoreUpstreamRepoProtocolInOriginUpdateBranch, v => Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch = v, nameof(Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch)); cps.SetString(() => CmdOption.OriginUpdateBranch, v => Config.OriginUpdateBranch = v, nameof(Config.OriginUpdateBranch)); cps.SetEnum(() => CmdOption.UpstreamCredMode, v => Config.UpstreamCredMode = v, nameof(Config.UpstreamCredMode)); } From cf8c43cb27b3dffe3a2928c921c142ede983ceec Mon Sep 17 00:00:00 2001 From: litetex Date: Fri, 5 Feb 2021 19:06:40 +0100 Subject: [PATCH 2/3] Updated cmd args --- src/PullDetachedRemote/CMD/CmdOption.cs | 10 +++++----- src/PullDetachedRemote/Config/Configuration.cs | 6 +++--- src/PullDetachedRemote/Runner.cs | 12 ++++++------ src/PullDetachedRemote/StartUp.cs | 4 ++-- src/PullDetachedRemote/Workflow/GitWorkflow.cs | 6 +++--- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/PullDetachedRemote/CMD/CmdOption.cs b/src/PullDetachedRemote/CMD/CmdOption.cs index 968182f..6ca047f 100644 --- a/src/PullDetachedRemote/CMD/CmdOption.cs +++ b/src/PullDetachedRemote/CMD/CmdOption.cs @@ -110,16 +110,16 @@ public class CmdOption public string UpstreamBranch { get; set; } /// - /// + /// /// [Option("ignoreprotocol")] - public string IgnoreUpstreamRepoProtocolInOriginUpdateBranch { get; set; } + public string IgnoreUpstreamRepoProtocolInUpdateBranch { get; set; } /// - /// + /// /// - [Option("nameoforiginupdatebranch")] - public string OriginUpdateBranch { get; set; } + [Option("updatebranch")] + public string UpdateBranch { get; set; } /// /// diff --git a/src/PullDetachedRemote/Config/Configuration.cs b/src/PullDetachedRemote/Config/Configuration.cs index e557f04..95254c7 100644 --- a/src/PullDetachedRemote/Config/Configuration.cs +++ b/src/PullDetachedRemote/Config/Configuration.cs @@ -83,15 +83,15 @@ public class Configuration : YamlConfig /// /// Optional; default is a auto generated name from the upstreamRepo + Branch /// - public string OriginUpdateBranch { get; set; } + public string UpdateBranch { get; set; } /// - /// Ignores the protocol (http/https/...) when generating the + /// Ignores the protocol (http/https) when generating the /// /// /// Optional; /// - public bool IgnoreUpstreamRepoProtocolInOriginUpdateBranch { get; set; } = false; + public bool IgnoreUpstreamRepoProtocolInUpdateBranch { get; set; } = false; /// /// GITHUB_TOKEN diff --git a/src/PullDetachedRemote/Runner.cs b/src/PullDetachedRemote/Runner.cs index 3ac32f5..434b579 100644 --- a/src/PullDetachedRemote/Runner.cs +++ b/src/PullDetachedRemote/Runner.cs @@ -228,7 +228,7 @@ private void ConfigureNameOfOriginUpdateBranch(GitWorkflow gitWorkflow) Log.Info($"Got default upstream-branch[name='{Config.UpstreamBranch}'] of '{Config.UpstreamRepo}'"); } - if (string.IsNullOrWhiteSpace(Config.OriginUpdateBranch)) + if (string.IsNullOrWhiteSpace(Config.UpdateBranch)) { var repoName = Config.UpstreamRepo; if (repoName.StartsWith("https:") || repoName.StartsWith("http:")) @@ -238,14 +238,14 @@ private void ConfigureNameOfOriginUpdateBranch(GitWorkflow gitWorkflow) repoName = newRepoName; } - Config.OriginUpdateBranch = $"upstreamupdate/{repoName}/{Config.UpstreamBranch}"; + Config.UpdateBranch = $"upstreamupdate/{repoName}/{Config.UpstreamBranch}"; } - Config.OriginUpdateBranch = GitBranchNormalizer.Fix(Config.OriginUpdateBranch); - if (string.IsNullOrWhiteSpace(Config.OriginUpdateBranch)) - throw new ArgumentException($"{nameof(Config.OriginUpdateBranch)}[='{Config.OriginUpdateBranch}'] is invalid"); + Config.UpdateBranch = GitBranchNormalizer.Fix(Config.UpdateBranch); + if (string.IsNullOrWhiteSpace(Config.UpdateBranch)) + throw new ArgumentException($"{nameof(Config.UpdateBranch)}[='{Config.UpdateBranch}'] is invalid"); - Log.Info($"{nameof(Config.OriginUpdateBranch)} is '{Config.OriginUpdateBranch}'"); + Log.Info($"{nameof(Config.UpdateBranch)} is '{Config.UpdateBranch}'"); } diff --git a/src/PullDetachedRemote/StartUp.cs b/src/PullDetachedRemote/StartUp.cs index 81ee33c..b718ddf 100644 --- a/src/PullDetachedRemote/StartUp.cs +++ b/src/PullDetachedRemote/StartUp.cs @@ -112,8 +112,8 @@ protected void ReadCMDConfig() cps.SetString(() => CmdOption.OriginBranch, v => Config.OriginBranch = v, nameof(Config.OriginBranch)); cps.SetString(() => CmdOption.UpstreamRepo, v => Config.UpstreamRepo = v, nameof(Config.UpstreamRepo)); cps.SetString(() => CmdOption.UpstreamBranch, v => Config.UpstreamBranch = v, nameof(Config.UpstreamBranch)); - cps.SetBool(() => CmdOption.IgnoreUpstreamRepoProtocolInOriginUpdateBranch, v => Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch = v, nameof(Config.IgnoreUpstreamRepoProtocolInOriginUpdateBranch)); - cps.SetString(() => CmdOption.OriginUpdateBranch, v => Config.OriginUpdateBranch = v, nameof(Config.OriginUpdateBranch)); + cps.SetBool(() => CmdOption.IgnoreUpstreamRepoProtocolInUpdateBranch, v => Config.IgnoreUpstreamRepoProtocolInUpdateBranch = v, nameof(Config.IgnoreUpstreamRepoProtocolInUpdateBranch)); + cps.SetString(() => CmdOption.UpdateBranch, v => Config.UpdateBranch = v, nameof(Config.UpdateBranch)); cps.SetEnum(() => CmdOption.UpstreamCredMode, v => Config.UpstreamCredMode = v, nameof(Config.UpstreamCredMode)); } diff --git a/src/PullDetachedRemote/Workflow/GitWorkflow.cs b/src/PullDetachedRemote/Workflow/GitWorkflow.cs index fb6df89..84ec5b3 100644 --- a/src/PullDetachedRemote/Workflow/GitWorkflow.cs +++ b/src/PullDetachedRemote/Workflow/GitWorkflow.cs @@ -216,11 +216,11 @@ protected string GenerateRemoteUpstreamName(IEnumerable exisitingRemoteN public bool CheckoutOriginUpdateBranch() { - OriginUpdateBranch = Repo.Branches.FirstOrDefault(x => x.FriendlyName == Config.OriginUpdateBranch); + OriginUpdateBranch = Repo.Branches.FirstOrDefault(x => x.FriendlyName == Config.UpdateBranch); if (OriginUpdateBranch == null) { - Log.Info($"Creating origin-update branch '{Config.OriginUpdateBranch}' from '{UpstreamBranch.FriendlyName}'"); - OriginUpdateBranch = Repo.CreateBranch(Config.OriginUpdateBranch, UpstreamBranch.Tip); + Log.Info($"Creating origin-update branch '{Config.UpdateBranch}' from '{UpstreamBranch.FriendlyName}'"); + OriginUpdateBranch = Repo.CreateBranch(Config.UpdateBranch, UpstreamBranch.Tip); Log.Info($"Created origin-update branch '{OriginUpdateBranch.FriendlyName}'[LatestCommit='{UpstreamBranch.Tip}']"); return true; From 7bd1138320af8bff9b995991707a354635049fac Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Fri, 5 Feb 2021 19:16:44 +0100 Subject: [PATCH 3/3] Update release-drafter.yml --- .github/release-drafter.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml index db51862..8793656 100644 --- a/.github/release-drafter.yml +++ b/.github/release-drafter.yml @@ -1,8 +1,19 @@ branches: - master - master-release-test -name-template: "v$NEXT_PATCH_VERSION" -tag-template: "v$NEXT_PATCH_VERSION" +name-template: "v$RESOLVED_VERSION" +tag-template: "v$RESOLVED_VERSION" +version-resolver: + major: + labels: + - 'major' + minor: + labels: + - 'minor' + patch: + labels: + - 'patch' + default: patch template: | ## Changes