Skip to content

Commit 91fbb1c

Browse files
authored
Fix content-source match when it has no matches (#2096)
1 parent 6237aca commit 91fbb1c

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/tooling/docs-assembler/Cli/ContentSourceCommands.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,13 @@ public async Task<int> Match([Argument] string? repository = null, [Argument] st
4747
var fs = new FileSystem();
4848
var service = new RepositoryBuildMatchingService(logFactory, configuration, configurationContext, githubActionsService, fs);
4949
serviceInvoker.AddCommand(service, (repository, branchOrTag),
50-
static async (s, collector, state, _) => await s.ShouldBuild(collector, state.repository, state.branchOrTag)
51-
);
50+
static async (s, collector, state, ctx) =>
51+
{
52+
_ = await s.ShouldBuild(collector, state.repository, state.branchOrTag);
53+
// ShouldBuild throws an exception on bad args and will return false if it has no matches
54+
// We return true to the service invoker to continue
55+
return true;
56+
});
5257

5358
return await serviceInvoker.InvokeAsync(ctx);
5459
}

src/tooling/docs-builder/Commands/Assembler/ContentSourceCommands.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,13 @@ public async Task<int> Match([Argument] string? repository = null, [Argument] st
4646
var fs = new FileSystem();
4747
var service = new RepositoryBuildMatchingService(logFactory, configuration, configurationContext, githubActionsService, fs);
4848
serviceInvoker.AddCommand(service, (repository, branchOrTag),
49-
static async (s, collector, state, _) => await s.ShouldBuild(collector, state.repository, state.branchOrTag)
50-
);
49+
static async (s, collector, state, ctx) =>
50+
{
51+
_ = await s.ShouldBuild(collector, state.repository, state.branchOrTag);
52+
// ShouldBuild throws an exception on bad args and will return false if it has no matches
53+
// We return true to the service invoker to continue
54+
return true;
55+
});
5156

5257
return await serviceInvoker.InvokeAsync(ctx);
5358
}

0 commit comments

Comments
 (0)