Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Declare few more files as DocumentationChanges #2100

Merged
merged 4 commits into from Feb 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 11 additions & 5 deletions Build/Build.cs
Expand Up @@ -348,11 +348,17 @@ void ReportTestOutcome(params string[] globFilters)
customLogger: (_, msg) => Error(msg));
});

bool HasDocumentationChanges =>
Changes.Any(x => x.StartsWith("docs"));
bool HasDocumentationChanges => Changes.Any(x => IsDocumentation(x));

bool HasSourceChanges =>
Changes.Any(x => !x.StartsWith("docs"));
bool HasSourceChanges => Changes.Any(x => !IsDocumentation(x));

static bool IsDocumentation(string x) =>
x.StartsWith("docs") ||
x.StartsWith("CONTRIBUTING.md") ||
x.StartsWith("cSpell.json") ||
x.StartsWith("LICENSE") ||
x.StartsWith("package.json") ||
x.StartsWith("README.md");

string[] Changes =>
Repository.Diff
Expand All @@ -365,7 +371,7 @@ void ReportTestOutcome(params string[] globFilters)
Tree TargetBranch => Repository.Branches[PullRequestBase].Tip.Tree;
Tree SourceBranch => Repository.Branches[Repository.Head.FriendlyName].Tip.Tree;

bool RunAllTargets => string.IsNullOrWhiteSpace(PullRequestBase);
bool RunAllTargets => string.IsNullOrWhiteSpace(PullRequestBase) || Changes.Any(x => x.StartsWith("Build"));

bool IsTag => BranchSpec != null && BranchSpec.Contains("refs/tags", StringComparison.InvariantCultureIgnoreCase);
}