From 58b91b72128c9bf7fc1d2927121d39a00737167f Mon Sep 17 00:00:00 2001 From: OCram85 Date: Mon, 5 Mar 2018 08:43:06 +0100 Subject: [PATCH] skip coverage report for PRs --- tools/AppVeyor.psm1 | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/tools/AppVeyor.psm1 b/tools/AppVeyor.psm1 index de78763..7cdebf0 100644 --- a/tools/AppVeyor.psm1 +++ b/tools/AppVeyor.psm1 @@ -153,13 +153,17 @@ Function Invoke-CoverageReport() { [ValidateNotNullOrEmpty()] [String]$RepoToken = $Env:CoverallsToken ) - - Import-Module ('.\src\{0}.psm1' -f $CALLSIGN) -Verbose -Force - $FileMap = New-PesterFileMap -SourceRoot '.\src' -PesterRoot '.\tests' - $CoverageReport = New-CoverageReport -PesterFileMap $FileMap -RepoToken $RepoToken - Write-Host "CoverageReport JSON:" -ForegroundColor Yellow - $CoverageReport | Out-String | Write-Host - Publish-CoverageReport -CoverageReport $CoverageReport + if ( $null -ne $RepoToken) { + Import-Module ('.\src\{0}.psm1' -f $CALLSIGN) -Verbose -Force + $FileMap = New-PesterFileMap -SourceRoot '.\src' -PesterRoot '.\tests' + $CoverageReport = New-CoverageReport -PesterFileMap $FileMap -RepoToken $RepoToken + Write-Host "CoverageReport JSON:" -ForegroundColor Yellow + $CoverageReport | Out-String | Write-Host + Publish-CoverageReport -CoverageReport $CoverageReport + } + else { + Write-Warning 'CoverallsToken var given but empty. This run is triggered by a PR. Skipping coverage report...' + } } Function Invoke-AppVeyorPSGallery() {