Skip to content

Commit e5f28d7

Browse files
committed
Prefer GITHUB_REPOSITORY for remote name
1 parent 55dd141 commit e5f28d7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Elastic.Markdown/IO/Discovery/GitCheckoutInformation.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public record GitCheckoutInformation
3333
public string? RepositoryName
3434
{
3535
get => _repositoryName ??= Remote.Split('/').Last();
36-
set => _repositoryName = value;
36+
init => _repositoryName = value;
3737
}
3838

3939
// manual read because libgit2sharp is not yet AOT ready
@@ -73,13 +73,15 @@ public static GitCheckoutInformation Create(IFileSystem fileSystem)
7373
using var streamReader = new StreamReader(stream);
7474
ini.Load(streamReader);
7575

76-
var remote = BranchTrackingRemote(branch, ini);
76+
var remote = Environment.GetEnvironmentVariable("GITHUB_REPOSITORY");
77+
if (string.IsNullOrEmpty(remote))
78+
remote = BranchTrackingRemote(branch, ini);
7779
if (string.IsNullOrEmpty(remote))
7880
remote = BranchTrackingRemote("main", ini);
7981
if (string.IsNullOrEmpty(remote))
8082
remote = BranchTrackingRemote("master", ini);
8183
if (string.IsNullOrEmpty(remote))
82-
remote = Environment.GetEnvironmentVariable("GITHUB_REPOSITORY") ?? "elastic/docs-builder-unknown";
84+
remote = "elastic/docs-builder-unknown";
8385

8486
remote = remote.AsSpan().TrimEnd(".git").ToString();
8587

0 commit comments

Comments
 (0)