mirror of
https://github.com/actions/runner.git
synced 2025-12-10 04:06:57 +00:00
Add an environment variable to indicate which repository the currently running Action came from. (#585)
* add `workflow_dispatch` * Add an environment variable to indicate which repository the currently running Action came from. * Expose the Action ref as well. * Move setting `github.action_repository` and `github.action_ref` to `ActionRunner.cs`. * Don't set `action_repository` and `action_ref` for local Actions. Co-authored-by: Tingluo Huang <tingluohuang@github.com>
This commit is contained in:
@@ -135,6 +135,14 @@ namespace GitHub.Runner.Worker
|
||||
ExecutionContext.SetGitHubContext("event_path", workflowFile);
|
||||
}
|
||||
|
||||
// Set GITHUB_ACTION_REPOSITORY if this Action is from a repository
|
||||
if (Action.Reference is Pipelines.RepositoryPathReference repoPathReferenceAction &&
|
||||
!string.Equals(repoPathReferenceAction.RepositoryType, Pipelines.PipelineConstants.SelfAlias, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
ExecutionContext.SetGitHubContext("action_repository", repoPathReferenceAction.Name);
|
||||
ExecutionContext.SetGitHubContext("action_ref", repoPathReferenceAction.Ref);
|
||||
}
|
||||
|
||||
// Setup container stephost for running inside the container.
|
||||
if (ExecutionContext.Global.Container != null)
|
||||
{
|
||||
|
||||
@@ -10,6 +10,8 @@ namespace GitHub.Runner.Worker
|
||||
{
|
||||
"action",
|
||||
"action_path",
|
||||
"action_ref",
|
||||
"action_repository",
|
||||
"actor",
|
||||
"api_url",
|
||||
"base_ref",
|
||||
@@ -55,4 +57,4 @@ namespace GitHub.Runner.Worker
|
||||
return copy;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user