private Annotation CreateAnnotation(AnnotationLevel checkWarningLevel, [NotNull] string cloneRoot, [NotNull] string title, [NotNull] string message, int lineNumber, int endLineNumber, string getFilePath) { if (cloneRoot == null) { throw new ArgumentNullException(nameof(cloneRoot)); } if (title == null) { throw new ArgumentNullException(nameof(title)); } if (message == null) { throw new ArgumentNullException(nameof(message)); } return(new Annotation( getFilePath, lineNumber, endLineNumber, checkWarningLevel, message) { Title = title }); }
public Annotation(string filename, int startLine, int endLine, AnnotationLevel annotationLevel, string message) { Filename = filename; AnnotationLevel = annotationLevel; Message = message; StartLine = startLine; EndLine = endLine; }
public static void Annotate(AnnotationLevel level, string context, string message, bool append = false) { string style; switch (level) { case AnnotationLevel.Info: style = "info"; break; case AnnotationLevel.Warning: style = "warning"; break; case AnnotationLevel.Error: style = "error"; break; case AnnotationLevel.Success: style = "success"; break; default: throw new ArgumentOutOfRangeException(nameof(level)); } var args = new List <string> { "annotate", message, "--style", style, "--context", context }; if (append) { args.Add("--append"); } Logger.Debug($"Annotating build with style '{style}', context '{context}':\n{message}"); var commandResult = Command .Run("buildkite-agent", args) .Result; if (!commandResult.Success) { throw new Exception($"Failed to annotate build\nStdout: {commandResult.StandardOutput}\nStderr: {commandResult.StandardError}"); } }