Skip to content
Merged
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
11 changes: 7 additions & 4 deletions src/tooling/docs-assembler/Cli/ContentSourceCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,14 @@ private void AssignOutputLogger()
public async Task<int> Match([Argument] string? repository = null, [Argument] string? branchOrTag = null, Cancel ctx = default)
{
AssignOutputLogger();
var logger = logFactory.CreateLogger<ContentSourceCommands>();

var repo = repository ?? githubActionsService.GetInput("repository");
var refName = branchOrTag ?? githubActionsService.GetInput("ref_name");
logger.LogInformation(" Validating '{Repository}' '{BranchOrTag}' ", repo, refName);

if (string.IsNullOrEmpty(repo))
throw new ArgumentNullException(nameof(repository));
var refName = branchOrTag ?? githubActionsService.GetInput("ref_name");
if (string.IsNullOrEmpty(refName))
throw new ArgumentNullException(nameof(branchOrTag));

Expand All @@ -50,18 +54,17 @@ public async Task<int> Match([Argument] string? repository = null, [Argument] st
Force = false,
AllowIndexing = false
};
var logger = logFactory.CreateLogger<ContentSourceCommands>();
var matches = assembleContext.Configuration.Match(repo, refName);
if (matches == null)
{
logger.LogInformation("'{Repository}' '{BranchOrTag}' combination not found in configuration.", repository, branchOrTag);
logger.LogInformation("'{Repository}' '{BranchOrTag}' combination not found in configuration.", repo, refName);
await githubActionsService.SetOutputAsync("content-source-match", "false");
await githubActionsService.SetOutputAsync("content-source-name", "");
}
else
{
var name = matches.Value.ToStringFast(true);
logger.LogInformation("'{Repository}' '{BranchOrTag}' is configured as '{Matches}' content-source", repository, branchOrTag, name);
logger.LogInformation("'{Repository}' '{BranchOrTag}' is configured as '{Matches}' content-source", repo, refName, name);

await githubActionsService.SetOutputAsync("content-source-match", "true");
await githubActionsService.SetOutputAsync("content-source-name", name);
Expand Down
Loading