mirror of
https://github.com/Jackett/Jackett
synced 2025-02-21 13:56:57 +00:00
Assist Release Note Creation Attempt 2 (#2165)
Logic wasn't quite right for which commits to include
This commit is contained in:
parent
3929ff2662
commit
4b11007393
2 changed files with 33 additions and 36 deletions
|
@ -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
|
||||
|
|
67
build.cake
67
build.cake
|
@ -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");
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue