Private GIT

Skip to content
Snippets Groups Projects
Commit df6434cd authored by flightlevel's avatar flightlevel Committed by vlbox
Browse files

Assist Release Note Creation Attempt 2 (#2165)

Logic wasn't quite right for which commits to include
parent 347662b8
Branches
No related tags found
No related merge requests found
version: 0.8.{build}
pull_requests:
do_not_increment_build_number: true
skip_tags: true
image: Visual Studio 2017
configuration: Release
......
......@@ -178,35 +178,34 @@ Task("Potential-Release-Notes")
.IsDependentOn("Appveyor-Push-Artifacts")
.Does(() =>
{
string tagHashLastGitHubTag = GitDescribe(".", false, GitDescribeStrategy.Tags, 100);
Information($"Tag and Hash of last release is: {tagHashLastGitHubTag}");
if (tagHashLastGitHubTag.Length > 40)
{
string lastReleaseHash = tagHashLastGitHubTag.Substring(tagHashLastGitHubTag.Length - 40);
Information($"Hash of first commit since last release is: {lastReleaseHash}" + Environment.NewLine);
string latestTag = GitDescribe(".", false, GitDescribeStrategy.Tags, 0);
Information($"Latest tag is: {latestTag}" + Environment.NewLine);
List<GitCommit> relevantCommits = new List<GitCommit>();
var commitCollection = GitLog("./", 50);
bool foundHash = false;
foreach(GitCommit commit in commitCollection)
{
relevantCommits.Add(commit);
var commitTag = GitDescribe(".", commit.Sha, false, GitDescribeStrategy.Tags, 0);
if (lastReleaseHash == commit.Sha)
if (commitTag == latestTag)
{
relevantCommits.Add(commit);
}
else
{
foundHash = true;
break;
}
}
if (foundHash)
relevantCommits = relevantCommits.AsEnumerable().Reverse().Skip(1).ToList();
if (relevantCommits.Count() > 0)
{
List<string> notesList = new List<string>();
foreach(GitCommit commit in relevantCommits.AsEnumerable().Reverse().ToList())
foreach(GitCommit commit in relevantCommits)
{
notesList.Add($"{commit.MessageShort} (Thank you @{commit.Author.Name})");
}
......@@ -218,9 +217,9 @@ Task("Potential-Release-Notes")
}
else
{
Information($"Unable to create potential release notes as the hash ({lastReleaseHash}) of the first commit since the last release wasn't found in the last 50 commits");
}
Information($"No commit messages found to create release notes");
}
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment