fix(worker): kept worktree in a company repo opens a PR, unexpected ADO/git errors never fail a task start
This commit is contained in:
@@ -282,8 +282,17 @@ public sealed class WorktreeManager
|
||||
.Select(c => c.BaseBranch)
|
||||
.FirstOrDefaultAsync(ct)).NullIfBlank();
|
||||
|
||||
if (isCompany && await FetchCompanyBaseAsync(workingDir, baseBranch, ct) is { } fetched)
|
||||
return fetched;
|
||||
if (isCompany)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (await FetchCompanyBaseAsync(workingDir, baseBranch, ct) is { } fetched) return fetched;
|
||||
}
|
||||
catch (Exception ex) when (ex is not OperationCanceledException)
|
||||
{
|
||||
_logger.LogWarning(ex, "Fetching the company base in {working_dir} failed, continuing with the local branch", workingDir);
|
||||
}
|
||||
}
|
||||
|
||||
return baseBranch is null
|
||||
? await _git.RevParseHeadAsync(workingDir, ct)
|
||||
@@ -304,7 +313,7 @@ public sealed class WorktreeManager
|
||||
if (basis is null && _azdo is not null && pat is not null && AzureDevOpsClient.ParseRemote(remote) is { } repo)
|
||||
{
|
||||
try { basis = await _azdo.GetDefaultBranchAsync(repo, ct); }
|
||||
catch (AzureDevOpsException ex) { _logger.LogWarning("Default branch from Azure DevOps unavailable: {reason}", ex.Message); }
|
||||
catch (Exception ex) when (ex is AzureDevOpsException or InvalidOperationException) { _logger.LogWarning("Default branch from Azure DevOps unavailable: {reason}", ex.Message); }
|
||||
}
|
||||
basis ??= await _git.GetRemoteHeadBranchAsync(workingDir, ct);
|
||||
if (basis is null)
|
||||
|
||||
Reference in New Issue
Block a user