-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement an Changelog generator for Qsor.Deploy (#47)
* add a basic changelog generator * Finish the implementation
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
using System; | ||
using System.Linq; | ||
using LibGit2Sharp; | ||
|
||
namespace Qsor.Deploy | ||
{ | ||
public static class ChangelogGenerator | ||
{ | ||
public static string GenerateChangelog() | ||
{ | ||
var repoPath = Repository.Discover("."); | ||
var repo = new Repository(repoPath); | ||
|
||
var changeLog = string.Empty; | ||
|
||
foreach (var commit in repo.Commits) | ||
{ | ||
var lastTag = repo.Tags.Last(); | ||
if (commit.Sha == lastTag.Target.Sha) | ||
break; | ||
|
||
changeLog += $"`{commit.Sha.Remove(7)}` {commit.MessageShort} - {commit.Author.Name} {Environment.NewLine}"; | ||
} | ||
|
||
return changeLog; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters