Skip to content

Commit

Permalink
Fix ReleaseSection end index when changelog contains empty lines
Browse files Browse the repository at this point in the history
  • Loading branch information
sandrofigo authored and matkoch committed May 15, 2023
1 parent 9ea5c86 commit d26bc33
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions source/Nuke.Common/ChangeLog/ChangeLogTasks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,15 +204,15 @@ static string GetCaption(string str)
}

var caption = GetCaption(line);
var nextNonReleaseContentIndex = content.FindIndex(index + 1, x => IsReleaseHead(x) || !IsReleaseContent(x));
var nextReleaseHeadIndex = content.FindIndex(index + 1, IsReleaseHead);

var releaseData =
new ReleaseSection
{
Caption = caption,
StartIndex = index,
EndIndex = nextNonReleaseContentIndex != -1
? nextNonReleaseContentIndex - 1
EndIndex = nextReleaseHeadIndex >= 0
? nextReleaseHeadIndex - 1
: content.Count - 1
};

Expand Down

0 comments on commit d26bc33

Please sign in to comment.