Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue 1234: Support GITHUB_ACTION_PATH in composite action 'uses' #1684

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/Runner.Worker/ActionManifestManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ private ActionExecutionData ConvertRuns(
};
}
}
else if (string.Equals(usingToken.Value, "node12", StringComparison.OrdinalIgnoreCase)||
else if (string.Equals(usingToken.Value, "node12", StringComparison.OrdinalIgnoreCase) ||
string.Equals(usingToken.Value, "node16", StringComparison.OrdinalIgnoreCase))
{
if (string.IsNullOrEmpty(mainToken?.Value))
Expand Down
9 changes: 9 additions & 0 deletions src/Runner.Worker/Handlers/CompositeActionHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ public async Task RunAsync(ActionRunStage stage)
gitHubContext = gitHubContext.ShallowCopy();
step.ExecutionContext.ExpressionValues["github"] = gitHubContext;

// Replace GITHUB_ACTION_PATH in composite action steps
var ActionReference = step.Action.Reference;
if (ActionReference is GitHub.DistributedTask.Pipelines.RepositoryPathReference)
{
var repoReference = ActionReference as GitHub.DistributedTask.Pipelines.RepositoryPathReference;
repoReference.Path = repoReference.Path.Replace("${GITHUB_ACTION_PATH}", ActionDirectory);
step.Action.Reference = repoReference;
}

// Set GITHUB_ACTION_PATH
step.ExecutionContext.SetGitHubContext("action_path", ActionDirectory);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -509,7 +509,7 @@ private static ActionStep ConvertToStep(
var image = uses.Value.Substring("docker://".Length);
result.Reference = new ContainerRegistryReference { Image = image };
}
else if (uses.Value.StartsWith("./") || uses.Value.StartsWith(".\\"))
else if (uses.Value.StartsWith("./") || uses.Value.StartsWith(".\\") || uses.Value.StartsWith("${GITHUB_ACTION_PATH}/"))
{
result.Reference = new RepositoryPathReference
{
Expand Down