check we are on master before pushing coverage report (#1143)

This means that forked PRs can now build as they don't need the coveralls secret
This commit is contained in:
Tom Pallister 2020-02-22 12:30:38 +00:00 committed by GitHub
parent def55b3c3c
commit 08512ec1c0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -134,11 +134,12 @@ Task("RunUnitTests")
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.opencover.xml"));
Information(coverageSummaryFile);
Information(artifactsForUnitTestsDir);
// todo bring back report generator to get a friendly report
// ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
// https://github.com/danielpalme/ReportGenerator
if (IsRunningOnCircleCI())
if (IsRunningOnCircleCI() && IsMaster())
{
var repoToken = EnvironmentVariable(coverallsRepoToken);
if (string.IsNullOrEmpty(repoToken))
@ -498,3 +499,8 @@ private bool IsRunningOnCircleCI()
{
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
}
private bool IsMaster()
{
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "master";
}