diff --git a/src/Runner.Worker/FileCommandManager.cs b/src/Runner.Worker/FileCommandManager.cs index 600db078a..a4eb2e676 100644 --- a/src/Runner.Worker/FileCommandManager.cs +++ b/src/Runner.Worker/FileCommandManager.cs @@ -182,6 +182,14 @@ namespace GitHub.Runner.Worker return; } + if (fileSize > AttachmentSizeLimit) + { + context.Error(String.Format(Constants.Runner.UnsupportedSummarySize, AttachmentSizeLimit / 1024, fileSize / 1024)); + Trace.Info($"Step Summary file ({filePath}) is too large ({fileSize} bytes); skipping attachment upload"); + + return; + } + Trace.Verbose($"Step Summary file exists: {filePath} and has a file size of {fileSize} bytes"); var scrubbedFilePath = filePath + "-scrubbed"; @@ -210,14 +218,6 @@ namespace GitHub.Runner.Worker } else { - if (fileSize > AttachmentSizeLimit) - { - context.Error(String.Format(Constants.Runner.UnsupportedSummarySize, AttachmentSizeLimit / 1024, fileSize / 1024)); - Trace.Info($"Step Summary file ({filePath}) is too large ({fileSize} bytes); skipping attachment upload"); - - return; - } - Trace.Info($"Queueing file ({filePath}) for attachment upload ({attachmentName})"); // Attachments must be added to the parent context (job), not the current context (step) context.Root.QueueAttachFile(ChecksAttachmentType.StepSummary, attachmentName, scrubbedFilePath);