Skip to content

Commit 08512ec

Browse files
authored
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
1 parent def55b3 commit 08512ec

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

build.cake

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,11 +134,12 @@ Task("RunUnitTests")
134134
var coverageSummaryFile = GetSubDirectories(artifactsForUnitTestsDir).First().CombineWithFilePath(File("coverage.opencover.xml"));
135135
Information(coverageSummaryFile);
136136
Information(artifactsForUnitTestsDir);
137+
137138
// todo bring back report generator to get a friendly report
138139
// ReportGenerator(coverageSummaryFile, artifactsForUnitTestsDir);
139140
// https://github.com/danielpalme/ReportGenerator
140-
141-
if (IsRunningOnCircleCI())
141+
142+
if (IsRunningOnCircleCI() && IsMaster())
142143
{
143144
var repoToken = EnvironmentVariable(coverallsRepoToken);
144145
if (string.IsNullOrEmpty(repoToken))
@@ -497,4 +498,9 @@ private string GetResource(string url)
497498
private bool IsRunningOnCircleCI()
498499
{
499500
return !string.IsNullOrWhiteSpace(Environment.GetEnvironmentVariable("CIRCLECI"));
501+
}
502+
503+
private bool IsMaster()
504+
{
505+
return Environment.GetEnvironmentVariable("CIRCLE_BRANCH").ToLower() == "master";
500506
}

0 commit comments

Comments
 (0)