Skip to content
Snippets Groups Projects
Commit fc593bb2 authored by L. Ellenbeck's avatar L. Ellenbeck
Browse files

Working variation

parent 1e0b0ec6
Branches
Tags
1 merge request!21Topic/570 git version
......@@ -138,7 +138,7 @@ Task("GitlabRelease")
var tagList = result.Content.ReadAsStringAsync().Result;
var jArray = JArray.Parse(tagList);
// null if not tags exists yet
var lastTag = jArray.FirstOrDefault();
var lastTag = jArray.Select(x => x["name"]).FirstOrDefault();
var url = $"https://git.rwth-aachen.de/{gitlabProjectPath}";
......@@ -165,12 +165,14 @@ Task("GitlabRelease")
logParam = $"{lastTag}..Head";
}
Information(lastTag);
IEnumerable<string> redirectedStandardOutput;
var exitCodeWithArgument =
StartProcess(
"git",
new ProcessSettings {
Arguments = $"log {logParam} --pretty=format:'%h %B'",
Arguments = $"log {logParam} --pretty=format:HASH%h:%B",
RedirectStandardOutput = true
},
out redirectedStandardOutput
......@@ -187,14 +189,22 @@ Task("GitlabRelease")
{"Chore", new List<string>()},
};
var currentHash = "";
// Output last line of process output.
foreach(var line in redirectedStandardOutput) {
var index = line.IndexOf(" ");
var commitHash = line.Substring(0, index);
var commitMessage = line.Substring(index + 1);
var commitMessage = "";
if(line.StartsWith("HASH")) {
currentHash = line.Substring("HASH".Length);
currentHash = currentHash.Substring(0, currentHash.IndexOf(":"));
commitMessage = line.Substring(currentHash.Length + line.IndexOf(currentHash) + 1);
} else {
commitMessage = line;
}
foreach(var kv in prefixList) {
if(commitMessage.StartsWith($"{kv.Key}:")) {
kv.Value.Add($"* {commitMessage.Substring(kv.Key.Length + 1).Trim()} {commitHash}");
kv.Value.Add($"* {commitMessage.Substring(kv.Key.Length + 1).Trim()} {currentHash}");
break;
}
};
}
......@@ -210,7 +220,7 @@ Task("GitlabRelease")
}
// correctly escape the json newlines
description = description.Replace("\n", "\\n");
Information("{0}", description);
Information("Description: {0}", description);
throw new Exception();
// create tag
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment