Skip to content

Commit 92943cd

Browse files
authored
Merge pull request #311 from JuergenRB/feature/AzureTargetNameInSummaryTitle
(GH-310): add target name to summary title
2 parents 2f7965d + d60bbef commit 92943cd

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/Cake.AzurePipelines.Module/AzurePipelinesReportPrinter.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ private void WriteToMarkdown(CakeReport report)
8383
sb.AppendLine("|:---|-------:|:-----|");
8484
}
8585

86+
var targetName = string.Empty;
8687
foreach (var item in report)
8788
{
8889
if (ShouldWriteTask(item))
@@ -96,9 +97,11 @@ private void WriteToMarkdown(CakeReport report)
9697
sb.AppendLine(string.Format(lineFormat, item.TaskName, FormatDuration(item), item.ExecutionStatus.ToReportStatus()));
9798
}
9899
}
100+
101+
targetName = item.TaskName; // Use the last task name it is the target name
99102
}
100103

101-
sb.AppendLine("");
104+
sb.AppendLine(string.Empty);
102105
var b = _context.BuildSystem().AzurePipelines;
103106
FilePath agentWorkPath = b.Environment.Build.ArtifactStagingDirectory + "/tasksummary.md";
104107
var absFilePath = agentWorkPath.MakeAbsolute(_context.Environment);
@@ -108,7 +111,7 @@ private void WriteToMarkdown(CakeReport report)
108111
writer.Write(sb.ToString());
109112
}
110113

111-
_console.WriteLine($"##vso[task.addattachment type=Distributedtask.Core.Summary;name=Cake Build Summary;]{absFilePath.MakeAbsolute(_context.Environment).FullPath}");
114+
_console.WriteLine($"##vso[task.addattachment type=Distributedtask.Core.Summary;name=Cake {targetName} Build Summary;]{absFilePath.MakeAbsolute(_context.Environment).FullPath}");
112115
}
113116
}
114117
}

0 commit comments

Comments
 (0)