@@ -76,18 +76,24 @@ public async Task<int> ValidateLocalLinkReference(string? file = null, string? p
7676 var repository = GitCheckoutInformation . Create ( root , new FileSystem ( ) , logger . CreateLogger ( nameof ( GitCheckoutInformation ) ) ) . RepositoryName
7777 ?? throw new Exception ( "Unable to determine repository name" ) ;
7878
79+ var resolvedFile = fs . FileInfo . New ( Path . Combine ( root . FullName , file ) ) ;
80+
7981 var runningOnCi = ! string . IsNullOrEmpty ( Environment . GetEnvironmentVariable ( "GITHUB_ACTIONS" ) ) ;
82+ if ( runningOnCi && ! resolvedFile . Exists )
83+ {
84+ _log . LogInformation ( "Running on CI after a build that produced no {File}, skipping the validation" , resolvedFile . FullName ) ;
85+ return 0 ;
86+ }
8087 if ( runningOnCi && ! Paths . TryFindDocsFolderFromRoot ( fs , root , out _ , out _ ) )
8188 {
82- _log . LogInformation ( "Running in CI on a folder with no docset.yml file in {Directory} , skipping the validation" , root . FullName ) ;
89+ _log . LogInformation ( "Running on CI, {Directory} has no documentation , skipping the validation" , root . FullName ) ;
8390 return 0 ;
8491 }
8592
86- var resolvedFile = Path . Combine ( root . FullName , file ) ;
8793 _log . LogInformation ( "Validating {File} in {Directory}" , file , root . FullName ) ;
8894
8995 await using var collector = new ConsoleDiagnosticsCollector ( logger , githubActionsService ) . StartAsync ( ctx ) ;
90- await _linkIndexLinkChecker . CheckWithLocalLinksJson ( collector , repository , resolvedFile , ctx ) ;
96+ await _linkIndexLinkChecker . CheckWithLocalLinksJson ( collector , repository , resolvedFile . FullName , ctx ) ;
9197 await collector . StopAsync ( ctx ) ;
9298 return collector . Errors ;
9399 }
0 commit comments