Skip to content

Commit 381ffec

Browse files
committed
Fix repository name detection on AppVeyor
1 parent 7ffbb84 commit 381ffec

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

tools/build/BuildDefinition.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -439,8 +439,13 @@ public static void Document(Options options)
439439
");
440440
}
441441

442-
private static string GitHubRepository => Environment.GetEnvironmentVariable("GITHUB_REPOSITORY") ?? "aaubry/YamlDotNet.Sandbox";
443-
442+
private static string GitHubRepository =>
443+
Program.Host switch
444+
{
445+
Host.Appveyor => Environment.GetEnvironmentVariable("APPVEYOR_REPO_NAME"),
446+
_ => Environment.GetEnvironmentVariable("GITHUB_REPOSITORY")
447+
}
448+
?? "aaubry/YamlDotNet.Sandbox";
444449

445450
private static readonly Lazy<HttpClient> GitHubClient = new Lazy<HttpClient>(() =>
446451
{

tools/build/Program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class Program
2222
public static bool NoPrerelease { get; private set; }
2323
public static string? ForcedVersion { get; private set; }
2424
private static bool verbose;
25-
private static Host host;
25+
public static Host Host { get; private set; }
2626
private static readonly Dictionary<Type, object> state = new Dictionary<Type, object>();
2727

2828
private static T GetState<T>() where T : notnull
@@ -136,7 +136,7 @@ static int Main(string[] args)
136136

137137
var (options, targets) = Options.Parse(filteredArguments);
138138
verbose = options.Verbose;
139-
host = options.Host.DetectIfUnknown().Item1;
139+
Host = options.Host.DetectIfUnknown().Item1;
140140

141141
var operatingSystem =
142142
RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
@@ -234,7 +234,7 @@ public static void WriteWarning(string text)
234234

235235
public static void WriteImportant(string text)
236236
{
237-
switch (host)
237+
switch (Host)
238238
{
239239
case Host.GitHubActions:
240240
Console.WriteLine($"Writing a warning");

0 commit comments

Comments
 (0)