1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-02-20 21:37:09 +00:00

Assist Release Note Creation Attempt 2 (#2165)

Logic wasn't quite right for which commits to include
This commit is contained in:
flightlevel 2017-11-19 18:37:47 +11:00 committed by GitHub
parent 3929ff2662
commit 4b11007393
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 36 deletions

View file

@ -1,6 +1,4 @@
version: 0.8.{build}
pull_requests:
do_not_increment_build_number: true
skip_tags: true
image: Visual Studio 2017
configuration: Release

View file

@ -178,49 +178,48 @@ 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 latestTag = GitDescribe(".", false, GitDescribeStrategy.Tags, 0);
Information($"Latest tag is: {latestTag}" + Environment.NewLine);
List<GitCommit> relevantCommits = new List<GitCommit>();
var commitCollection = GitLog("./", 50);
foreach(GitCommit commit in commitCollection)
{
string lastReleaseHash = tagHashLastGitHubTag.Substring(tagHashLastGitHubTag.Length - 40);
Information($"Hash of first commit since last release is: {lastReleaseHash}" + Environment.NewLine);
var commitTag = GitDescribe(".", commit.Sha, false, GitDescribeStrategy.Tags, 0);
List<GitCommit> relevantCommits = new List<GitCommit>();
var commitCollection = GitLog("./", 50);
bool foundHash = false;
foreach(GitCommit commit in commitCollection)
if (commitTag == latestTag)
{
relevantCommits.Add(commit);
if (lastReleaseHash == commit.Sha)
{
foundHash = true;
break;
}
}
if (foundHash)
{
List<string> notesList = new List<string>();
foreach(GitCommit commit in relevantCommits.AsEnumerable().Reverse().ToList())
{
notesList.Add($"{commit.MessageShort} (Thank you @{commit.Author.Name})");
}
string buildNote = String.Join(Environment.NewLine, notesList);
Information(buildNote);
FileAppendLines(workingDir + "\\BuildOutput\\ReleaseNotes.txt", notesList.ToArray());
}
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");
break;
}
}
relevantCommits = relevantCommits.AsEnumerable().Reverse().Skip(1).ToList();
if (relevantCommits.Count() > 0)
{
List<string> notesList = new List<string>();
foreach(GitCommit commit in relevantCommits)
{
notesList.Add($"{commit.MessageShort} (Thank you @{commit.Author.Name})");
}
string buildNote = String.Join(Environment.NewLine, notesList);
Information(buildNote);
FileAppendLines(workingDir + "\\BuildOutput\\ReleaseNotes.txt", notesList.ToArray());
}
else
{
Information($"No commit messages found to create release notes");
}
});