Compare commits

...

1 Commits

Author SHA1 Message Date
TingluoHuang
7d316c0a75 Add notice annotation for the git unsafe directory error. 2022-04-20 00:56:38 -04:00
2 changed files with 7 additions and 0 deletions

View File

@@ -154,6 +154,12 @@ namespace GitHub.Runner.Worker.Handlers
if (line.Contains("fatal: unsafe repository", StringComparison.OrdinalIgnoreCase)) if (line.Contains("fatal: unsafe repository", StringComparison.OrdinalIgnoreCase))
{ {
_executionContext.StepTelemetry.ErrorMessages.Add(line); _executionContext.StepTelemetry.ErrorMessages.Add(line);
var gitUnsafeDirNotice = new DTWebApi.Issue
{
Message = $"You may experience error caused by a recently git safe directory enforcement. For more information see: https://github.blog/changelog/xxx",
Type = DTWebApi.IssueType.Notice,
};
_executionContext.AddIssue(gitUnsafeDirNotice);
} }
// Regular output // Regular output

View File

@@ -947,6 +947,7 @@ namespace GitHub.Runner.Common.Tests.Worker
{ {
Process("fatal: unsafe repository ('/github/workspace' is owned by someone else)"); Process("fatal: unsafe repository ('/github/workspace' is owned by someone else)");
Assert.Contains("fatal: unsafe repository ('/github/workspace' is owned by someone else)", _executionContext.Object.StepTelemetry.ErrorMessages); Assert.Contains("fatal: unsafe repository ('/github/workspace' is owned by someone else)", _executionContext.Object.StepTelemetry.ErrorMessages);
Assert.Contains(_issues, x => x.Item1.Type == DTWebApi.IssueType.Notice && x.Item1.Message.Contains("You may experience error caused by a recently git safe directory enforcement"));
} }
} }