@@ -39,6 +39,7 @@ public async Task Serve(string? path = null, Cancel ctx = default)
3939 /// <param name="output"> -o, Defaults to `.artifacts/html` </param>
4040 /// <param name="pathPrefix"> Specifies the path prefix for urls </param>
4141 /// <param name="force"> Force a full rebuild of the destination folder</param>
42+ /// <param name="strict"> Treat warnings as errors and fail the build on warnings</param>
4243 /// <param name="ctx"></param>
4344 [ Command ( "generate" ) ]
4445 [ ConsoleAppFilter < StopwatchFilter > ]
@@ -48,6 +49,7 @@ public async Task<int> Generate(
4849 string ? output = null ,
4950 string ? pathPrefix = null ,
5051 bool ? force = null ,
52+ bool ? strict = null ,
5153 Cancel ctx = default
5254 )
5355 {
@@ -62,7 +64,13 @@ public async Task<int> Generate(
6264 var set = new DocumentationSet ( context ) ;
6365 var generator = new DocumentationGenerator ( set , logger ) ;
6466 await generator . GenerateAll ( ctx ) ;
65- return context . Collector . Errors + context . Collector . Warnings ;
67+
68+ if ( bool . TryParse ( githubActionsService . GetInput ( "strict" ) , out var strictValue ) && strictValue )
69+ strict ??= strictValue ;
70+
71+ if ( strict ?? false )
72+ return context . Collector . Errors + context . Collector . Warnings ;
73+ return context . Collector . Errors ;
6674 }
6775
6876 /// <summary>
@@ -72,6 +80,7 @@ public async Task<int> Generate(
7280 /// <param name="output"> -o, Defaults to `.artifacts/html` </param>
7381 /// <param name="pathPrefix"> Specifies the path prefix for urls </param>
7482 /// <param name="force"> Force a full rebuild of the destination folder</param>
83+ /// <param name="strict"> Treat warnings as errors and fail the build on warnings</param>
7584 /// <param name="ctx"></param>
7685 [ Command ( "" ) ]
7786 [ ConsoleAppFilter < StopwatchFilter > ]
@@ -81,7 +90,8 @@ public async Task<int> GenerateDefault(
8190 string ? output = null ,
8291 string ? pathPrefix = null ,
8392 bool ? force = null ,
93+ bool ? strict = null ,
8494 Cancel ctx = default
8595 ) =>
86- await Generate ( path , output , pathPrefix , force , ctx ) ;
96+ await Generate ( path , output , pathPrefix , force , strict , ctx ) ;
8797}
0 commit comments