Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Running target only when files (e.g from glob pattern) have changed #1098

Answered by Basyras
IT-VBFK asked this question in Q&A
Discussion options

You must be logged in to vote

I would put the "if" logic inside the Nuke target. That target would run every time but it could get Git changed files and based on that it could do the docs spell check or not. I am currently using the same approach for running unit test just for changed files.

Snippet:

		using (var repo = new LibGit2Sharp.Repository(localGitFolder))
		{
			GetBranchesToCompare(repo, oldBranchName, out var newBranchLocal, out var oldBranchLocal);
			var paths = repo.Diff.Compare<LibGit2Sharp.TreeChanges>(oldBranchLocal.Tip.Tree, newBranchLocal.Tip.Tree)
					.Where(x => x.Exists)
					.Select(x => x.Path);
                        if(paths.Any(x=>x.StartsWith("docs")))
                        {
          …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by IT-VBFK
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants