Examples

The following example prints the number of binary files which are not tracked by Git Large File Storage in a repository.

Warning

Checking binary files requires Git and Git Large File Storage available on the local machine.

To analyze Git repositories you need to import the core addin and the Git repository support:

#addin "Cake.Issues"
#addin "Cake.Issues.GitRepository"

Warning

Please note that you always should pin addins to a specific version to make sure your builds are deterministic and won't break due to updates to one of the addins.

See pinning addin versions for details.

We need some global variables:

var repoRootPath = @"c:\repo";

The following task will analyze the repository:

Task("Analyze-Repo")
.Does(() =>
{
    // Read Issues.
    var settings =
        new GitRepositoryIssuesSettings
        {
            CheckBinaryFilesTrackedByLfs = true
        };

    var issues =
        ReadIssues(
            GitRepositoryIssues(settings),
            repoRootPath);

    Information("{0} issues are found.", issues.Count());
});