Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ inputs:
prefix:
description: 'Path prefix for all urls'
required: false
strict:
description: 'Treat warnings as errors'
required: false

runs:
using: 'docker'
Expand Down
6 changes: 6 additions & 0 deletions actions/publish/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ outputs:
description: "The github actions url"
value: ${{steps.deployment.outputs.page_url}}

inputs:
strict:
description: 'Treat warnings as errors'
required: false

runs:
using: "composite"
steps:
Expand All @@ -20,6 +25,7 @@ runs:
uses: elastic/docs-builder@main
with:
prefix: '${{ steps.repo-basename.outputs.value }}'
strict: ${{ inputs.strict }}
- name: Setup Pages
id: pages
uses: actions/[email protected]
Expand Down
14 changes: 12 additions & 2 deletions src/docs-builder/Cli/Commands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ public async Task Serve(string? path = null, Cancel ctx = default)
/// <param name="output"> -o, Defaults to `.artifacts/html` </param>
/// <param name="pathPrefix"> Specifies the path prefix for urls </param>
/// <param name="force"> Force a full rebuild of the destination folder</param>
/// <param name="strict"> Treat warnings as errors and fail the build on warnings</param>
/// <param name="ctx"></param>
[Command("generate")]
[ConsoleAppFilter<StopwatchFilter>]
Expand All @@ -48,6 +49,7 @@ public async Task<int> Generate(
string? output = null,
string? pathPrefix = null,
bool? force = null,
bool? strict = null,
Cancel ctx = default
)
{
Expand All @@ -62,7 +64,13 @@ public async Task<int> Generate(
var set = new DocumentationSet(context);
var generator = new DocumentationGenerator(set, logger);
await generator.GenerateAll(ctx);
return context.Collector.Errors + context.Collector.Warnings;

if (bool.TryParse(githubActionsService.GetInput("strict"), out var strictValue) && strictValue)
strict ??= strictValue;

if (strict ?? false)
return context.Collector.Errors + context.Collector.Warnings;
return context.Collector.Errors;
}

/// <summary>
Expand All @@ -72,6 +80,7 @@ public async Task<int> Generate(
/// <param name="output"> -o, Defaults to `.artifacts/html` </param>
/// <param name="pathPrefix"> Specifies the path prefix for urls </param>
/// <param name="force"> Force a full rebuild of the destination folder</param>
/// <param name="strict"> Treat warnings as errors and fail the build on warnings</param>
/// <param name="ctx"></param>
[Command("")]
[ConsoleAppFilter<StopwatchFilter>]
Expand All @@ -81,7 +90,8 @@ public async Task<int> GenerateDefault(
string? output = null,
string? pathPrefix = null,
bool? force = null,
bool? strict = null,
Cancel ctx = default
) =>
await Generate(path, output, pathPrefix, force, ctx);
await Generate(path, output, pathPrefix, force, strict, ctx);
}
Loading