fix(github-action-writer): Fix string split for property writing#10
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR fixes newline handling when writing scalar properties in the GitHub Actions YAML writer, ensuring multiline string values are emitted as YAML block scalars instead of incorrectly staying inline.
Changes:
- Fixes the newline split logic in
GithubActionWriter.WriteProperty(string, string)so multiline values are detected. - Adds targeted NUnit tests to validate block-scalar emission for
\n,\r, and\r\nnewlines in env values.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/Invex.StructuredText.GithubActions/GithubActionWriter.cs |
Updates string splitting used to decide between inline scalar vs block scalar output. |
tests/Invex.StructuredText.GithubActions.Tests/GithubActionWriterPropertyTests.cs |
Adds tests covering multiline scalar property output via job env values. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This pull request improves the handling of environment variable values with different newline formats in the GitHub Actions YAML writer. It updates the splitting logic for multiline values and adds comprehensive tests to ensure correct YAML output for both single-line and multiline environment variable values.
Testing improvements:
GithubActionWriterPropertyTeststo verify that environment variable values containing different types of newlines (\n,\r,\r\n) are correctly emitted as YAML block scalars, and that single-line values remain inline.Code correctness and compatibility:
WritePropertymethod inGithubActionWriter.csto use a more robust splitting approach for newlines by passing an array of newline characters toSplit, ensuring all newline variants are handled consistently.