Skip to content

Commit

Permalink
check we are on master before pushing coverage report (#1143)
Browse files Browse the repository at this point in the history
This means that forked PRs can now build as they don't need the coveralls secret
  • Loading branch information
TomPallister authored Feb 22, 2020
1 parent def55b3 commit 08512ec
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -497,4 +498,9 @@ private string GetResource(string url)
private bool IsRunningOnCircleCI()
{
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
}

private bool IsMaster()
{
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "master";
}

0 comments on commit 08512ec

Please sign in to comment.