mirror of
https://github.com/actions/runner.git
synced 2025-12-12 05:37:01 +00:00
add github.url and github.api_url for ghes alpha (#386)
This commit is contained in:
@@ -10,6 +10,7 @@ namespace GitHub.Runner.Worker
|
|||||||
{
|
{
|
||||||
"action",
|
"action",
|
||||||
"actor",
|
"actor",
|
||||||
|
"api_url", // temp for GHES alpha release
|
||||||
"base_ref",
|
"base_ref",
|
||||||
"event_name",
|
"event_name",
|
||||||
"event_path",
|
"event_path",
|
||||||
@@ -21,6 +22,7 @@ namespace GitHub.Runner.Worker
|
|||||||
"run_id",
|
"run_id",
|
||||||
"run_number",
|
"run_number",
|
||||||
"sha",
|
"sha",
|
||||||
|
"url", // temp for GHES alpha release
|
||||||
"workflow",
|
"workflow",
|
||||||
"workspace",
|
"workspace",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
@@ -127,6 +128,17 @@ namespace GitHub.Runner.Worker
|
|||||||
context.SetRunnerContext("workspace", Path.Combine(_workDirectory, trackingConfig.PipelineDirectory));
|
context.SetRunnerContext("workspace", Path.Combine(_workDirectory, trackingConfig.PipelineDirectory));
|
||||||
context.SetGitHubContext("workspace", Path.Combine(_workDirectory, trackingConfig.WorkspaceDirectory));
|
context.SetGitHubContext("workspace", Path.Combine(_workDirectory, trackingConfig.WorkspaceDirectory));
|
||||||
|
|
||||||
|
// Temporary hack for GHES alpha
|
||||||
|
var configurationStore = HostContext.GetService<IConfigurationStore>();
|
||||||
|
var runnerSettings = configurationStore.GetSettings();
|
||||||
|
if (!runnerSettings.IsHostedServer && !string.IsNullOrEmpty(runnerSettings.GitHubUrl))
|
||||||
|
{
|
||||||
|
var url = new Uri(runnerSettings.GitHubUrl);
|
||||||
|
var portInfo = url.IsDefaultPort ? string.Empty : $":{url.Port.ToString(CultureInfo.InvariantCulture)}";
|
||||||
|
context.SetGitHubContext("url", $"{url.Scheme}://{url.Host}{portInfo}");
|
||||||
|
context.SetGitHubContext("api_url", $"{url.Scheme}://api.{url.Host}{portInfo}");
|
||||||
|
}
|
||||||
|
|
||||||
// Evaluate the job-level environment variables
|
// Evaluate the job-level environment variables
|
||||||
context.Debug("Evaluating job-level environment variables");
|
context.Debug("Evaluating job-level environment variables");
|
||||||
var templateEvaluator = context.ToPipelineTemplateEvaluator();
|
var templateEvaluator = context.ToPipelineTemplateEvaluator();
|
||||||
|
|||||||
Reference in New Issue
Block a user