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
39 changes: 16 additions & 23 deletions src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,37 +78,30 @@ public static GitCheckoutInformation Create(IDirectoryInfo source, IFileSystem f
ini.Load(streamReader);

var remote = Environment.GetEnvironmentVariable("GITHUB_REPOSITORY");
logger?.LogInformation("Remote from environment: {GitRemote}", remote);
if (string.IsNullOrEmpty(remote))
{
remote = BranchTrackingRemote(branch, ini);
logger?.LogInformation("Remote from branch: {GitRemote}", remote);
}

if (string.IsNullOrEmpty(remote))
{
remote = BranchTrackingRemote("main", ini);
logger?.LogInformation("Remote from main branch: {GitRemote}", remote);
}
if (string.IsNullOrEmpty(remote))
{
remote = BranchTrackingRemote("main", ini);
logger?.LogInformation("Remote from main branch: {GitRemote}", remote);
}

if (string.IsNullOrEmpty(remote))
{
remote = BranchTrackingRemote("master", ini);
logger?.LogInformation("Remote from master branch: {GitRemote}", remote);
}
if (string.IsNullOrEmpty(remote))
{
remote = BranchTrackingRemote("master", ini);
logger?.LogInformation("Remote from master branch: {GitRemote}", remote);
}

if (string.IsNullOrEmpty(remote))
{
remote = "elastic/docs-builder-unknown";
logger?.LogInformation("Remote from fallback: {GitRemote}", remote);
if (string.IsNullOrEmpty(remote))
{
remote = "elastic/docs-builder-unknown";
logger?.LogInformation("Remote from fallback: {GitRemote}", remote);
}
remote = remote.AsSpan().TrimEnd("git").TrimEnd('.').ToString();
}

remote = remote.AsSpan().TrimEnd("git").TrimEnd('.').ToString();

logger?.LogInformation("Remote trimmed: {GitRemote}", remote);
if (remote.EndsWith("docs-conten"))
remote += "t";

var info = new GitCheckoutInformation
{
Ref = gitRef,
Expand Down