From 08b9f6e045bbbec479789efb2a8e6feb9727ed84 Mon Sep 17 00:00:00 2001 From: Thomas Boop <52323235+thboop@users.noreply.github.com> Date: Mon, 28 Oct 2019 15:45:27 -0400 Subject: [PATCH] Merge release 160.0 into master (#153) * Update to Version 2.160.0 (#144) * Revert "remove issue generation on warning/error commands (#137)" (#147) * Revert "remove issue generation on warning/error commands (#137)" This reverts commit 53da19886768e053ff15beec406709571e091feb. * Updated Release notes * Users/thboop/port directory changes (#152) * Clear action cache for local runner * update release notes for actions directory cache changes --- releaseNote.md | 8 ++-- src/Runner.Worker/ActionCommandManager.cs | 50 +++++++++++++++++++++++ src/runnerversion | 2 +- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/releaseNote.md b/releaseNote.md index 723e30b7f..34f3aa6a8 100644 --- a/releaseNote.md +++ b/releaseNote.md @@ -1,12 +1,12 @@ ## Features - - Set Default shell to powershell for windows runners (#135) - - Use Powershell as fallback if Powershell Core is not available for default shell on windows (#142) + - N/A ## Bugs - - Removed unintended additional fields on error and warning commands (#137) + - Reverted removal of additional fields error and warning fields (#147) + - Actions cache would incorrectly cache the action if the tag was updated (#148) ## Misc - - N/A + - Updated to .NET Core 3.0 (#127) ## Agent Downloads diff --git a/src/Runner.Worker/ActionCommandManager.cs b/src/Runner.Worker/ActionCommandManager.cs index e3b07840e..a1a268d60 100644 --- a/src/Runner.Worker/ActionCommandManager.cs +++ b/src/Runner.Worker/ActionCommandManager.cs @@ -436,6 +436,10 @@ namespace GitHub.Runner.Worker public void ProcessCommand(IExecutionContext context, string inputLine, ActionCommand command) { + command.Properties.TryGetValue(IssueCommandProperties.File, out string file); + command.Properties.TryGetValue(IssueCommandProperties.Line, out string line); + command.Properties.TryGetValue(IssueCommandProperties.Column, out string column); + Issue issue = new Issue() { Category = "General", @@ -443,8 +447,54 @@ namespace GitHub.Runner.Worker Message = command.Data }; + if (!string.IsNullOrEmpty(file)) + { + issue.Category = "Code"; + + if (context.Container != null) + { + // Translate file path back from container path + file = context.Container.TranslateToHostPath(file); + command.Properties[IssueCommandProperties.File] = file; + } + + // Get the values that represent the server path given a local path + string repoName = context.GetGitHubContext("repository"); + var repoPath = context.GetGitHubContext("workspace"); + + string relativeSourcePath = IOUtil.MakeRelative(file, repoPath); + if (!string.Equals(relativeSourcePath, file, IOUtil.FilePathStringComparison)) + { + // add repo info + if (!string.IsNullOrEmpty(repoName)) + { + command.Properties["repo"] = repoName; + } + + if (!string.IsNullOrEmpty(relativeSourcePath)) + { + // replace sourcePath with the new relative path + // prefer `/` on all platforms + command.Properties[IssueCommandProperties.File] = relativeSourcePath.Replace(Path.DirectorySeparatorChar, Path.AltDirectorySeparatorChar); + } + } + } + + foreach (var property in command.Properties) + { + issue.Data[property.Key] = property.Value; + } + context.AddIssue(issue); } + + private static class IssueCommandProperties + { + public const String File = "file"; + public const String Line = "line"; + public const String Column = "col"; + } + } public sealed class GroupCommandExtension : GroupingCommandExtension diff --git a/src/runnerversion b/src/runnerversion index 4db89d31f..fef351cca 100644 --- a/src/runnerversion +++ b/src/runnerversion @@ -1 +1 @@ -2.159.2 \ No newline at end of file +2.160.0 \ No newline at end of file