mirror of
https://github.com/actions/runner.git
synced 2025-12-28 12:27:48 +08:00
fix problem matcher to treat fromPath as a file path (#183)
This commit is contained in:
@@ -263,15 +263,17 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
// Root using fromPath
|
||||
if (!string.IsNullOrWhiteSpace(match.FromPath) && !Path.IsPathRooted(file))
|
||||
{
|
||||
file = Path.Combine(match.FromPath, file);
|
||||
var fromDirectory = Path.GetDirectoryName(match.FromPath);
|
||||
if (!string.IsNullOrWhiteSpace(fromDirectory))
|
||||
{
|
||||
file = Path.Combine(fromDirectory, file);
|
||||
}
|
||||
}
|
||||
|
||||
// Root using system.defaultWorkingDirectory
|
||||
// Root using workspace
|
||||
if (!Path.IsPathRooted(file))
|
||||
{
|
||||
var githubContext = _executionContext.ExpressionValues["github"] as GitHubContext;
|
||||
ArgUtil.NotNull(githubContext, nameof(githubContext));
|
||||
var workspace = githubContext["workspace"].ToString();
|
||||
var workspace = _executionContext.GetGitHubContext("workspace");
|
||||
ArgUtil.NotNullOrEmpty(workspace, "workspace");
|
||||
|
||||
file = Path.Combine(workspace, file);
|
||||
@@ -297,7 +299,7 @@ namespace GitHub.Runner.Worker.Handlers
|
||||
}
|
||||
else
|
||||
{
|
||||
// prefer `/` on all platforms
|
||||
// Prefer `/` on all platforms
|
||||
issue.Data["file"] = file.Substring(repositoryPath.Length).TrimStart(Path.DirectorySeparatorChar).Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user