Skip to content

fix(github-action-writer): Fix string split for property writing#10

Merged
DecSmith42 merged 1 commit into
mainfrom
patch/github-property-line-split
Jun 24, 2026
Merged

fix(github-action-writer): Fix string split for property writing#10
DecSmith42 merged 1 commit into
mainfrom
patch/github-property-line-split

Conversation

@DecSmith42

@DecSmith42 DecSmith42 commented Jun 24, 2026

Copy link
Copy Markdown
Collaborator

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:

  • Added a new test suite GithubActionWriterPropertyTests to 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:

  • Updated the WriteProperty method in GithubActionWriter.cs to use a more robust splitting approach for newlines by passing an array of newline characters to Split, ensuring all newline variants are handled consistently.

Copilot AI review requested due to automatic review settings June 24, 2026 05:17
@DecSmith42 DecSmith42 enabled auto-merge June 24, 2026 05:17

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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\n newlines 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.

Comment thread src/Invex.StructuredText.GithubActions/GithubActionWriter.cs
@DecSmith42 DecSmith42 disabled auto-merge June 24, 2026 05:22
@DecSmith42 DecSmith42 merged commit 6c8db2b into main Jun 24, 2026
9 checks passed
@DecSmith42 DecSmith42 deleted the patch/github-property-line-split branch June 24, 2026 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants