-
-
Notifications
You must be signed in to change notification settings - Fork 24
Truncate or omit step summary when approaching GitHub's 1 MiB limit #68
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
8c54cf8
Initial plan
Copilot e9d558d
Improve UX when step summary hits GitHub's 1 MiB limit
Copilot b279a6f
Address reviewer feedback: cast-based file detection, WriteAllZeroes,…
Copilot 7f89bcd
Remove comment from WriteAllZeroes; inline warning string builders
Copilot 7cf9546
Apply suggestion from @Tyrrrz
Tyrrrz d17407d
Address reviewer feedback: TempFile, ReadAllBytes ext, GitHubAnnotati…
Copilot 784dc64
Rename ReadAllBytes parameter start -> offset
Copilot 97273ce
Use stream seeking in ReadAllBytes extension instead of allocating al…
Copilot 49bc721
Arrow methods, lowercase kind, simplified truncation, move enum, auto…
Copilot fb88931
Address review: SummaryFileSizeLimit in GitHubEnvironment, async arro…
Copilot f9e273e
Use File.Open instead of new FileStream in truncation tests
Copilot 0d8d107
Update GitHubActionsTestLogger/GitHub/GitHubWorkflow.cs
Tyrrrz be56208
Use generic wording in truncation/omission warning messages
Copilot 406b4ad
Use Math.Min for available-size clamping; fix formatting
Copilot 0855cae
Fix ReadAllBytes to use FileShare.ReadWrite to prevent Windows file l…
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
GitHubActionsTestLogger.Tests/Utils/Extensions/FileExtensions.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| using System.IO; | ||
|
|
||
| namespace GitHubActionsTestLogger.Tests.Utils.Extensions; | ||
|
|
||
| internal static class FileExtensions | ||
| { | ||
| extension(File) | ||
| { | ||
| public static void WriteAllZeroes(string path, long count) | ||
| { | ||
| using var stream = new FileStream( | ||
| path, | ||
| FileMode.Create, | ||
| FileAccess.Write, | ||
| FileShare.None, | ||
| bufferSize: 1 | ||
| ); | ||
|
|
||
| stream.SetLength(count); | ||
| } | ||
|
|
||
| public static byte[] ReadAllBytes(string path, int offset) | ||
| { | ||
| using var stream = new FileStream( | ||
| path, | ||
| FileMode.Open, | ||
| FileAccess.Read, | ||
| FileShare.ReadWrite | ||
| ); | ||
| stream.Seek(offset, SeekOrigin.Begin); | ||
|
|
||
| var buffer = new byte[stream.Length - offset]; | ||
| stream.ReadExactly(buffer); | ||
|
|
||
|
Tyrrrz marked this conversation as resolved.
Tyrrrz marked this conversation as resolved.
|
||
| return buffer; | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| using System; | ||
| using System.IO; | ||
| using System.Reflection; | ||
|
|
||
| namespace GitHubActionsTestLogger.Tests.Utils; | ||
|
|
||
| internal partial class TempFile(string path) : IDisposable | ||
| { | ||
| public string Path { get; } = path; | ||
|
|
||
| public void Dispose() | ||
| { | ||
| try | ||
| { | ||
| File.Delete(Path); | ||
| } | ||
| catch (FileNotFoundException) { } | ||
| } | ||
| } | ||
|
|
||
| internal partial class TempFile | ||
| { | ||
| public static TempFile Create() | ||
| { | ||
| var dirPath = System.IO.Path.Combine( | ||
| System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) | ||
| ?? Directory.GetCurrentDirectory(), | ||
| "Temp" | ||
| ); | ||
|
|
||
| Directory.CreateDirectory(dirPath); | ||
|
|
||
| var filePath = System.IO.Path.Combine(dirPath, Guid.NewGuid() + ".tmp"); | ||
|
|
||
| return new TempFile(filePath); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| namespace GitHubActionsTestLogger.GitHub; | ||
|
|
||
| internal enum GitHubAnnotationKind | ||
| { | ||
| Error, | ||
| Warning, | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.