Skip to content
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

Support reading values containing line separators #64

Closed
Fallen-Breath opened this issue Oct 15, 2024 · 1 comment
Closed

Support reading values containing line separators #64

Fallen-Breath opened this issue Oct 15, 2024 · 1 comment

Comments

@Fallen-Breath
Copy link

If the properties files contains value containing line separators, e.g.:

abc=123
foo=bar\nbaz

The github action will fail, since the content format of the GITHUB_OUTPUT file cannot be recognized by the workflow

GITHUB_OUTPUT output with the current inplementation:

abc=123
foo=bar
baz

Expected GITHUB_OUTPUT output (using the method from github/docs#21529):

abc=123
foo<<DELIMITER
bar
baz
DELIMITER

Example implentation, just for a reference

fun packKeyValue(key: Any, value: Any): String {
    val s = value.toString()
    if (s.contains('\n') || s.contains('\r')) {
        var delimiter = "VALUE_DELIMITER"
        while (s.contains(delimiter)) {
            delimiter += "_X"
        }
        return "$key<<$delimiter${lineSeparator()}$s${lineSeparator()}$delimiter"
    } else {
        return "$key=$value"
    }
}
madhead added a commit that referenced this issue Oct 20, 2024
Fix #64: Support reading values containing line separators
@madhead
Copy link
Owner

madhead commented Oct 20, 2024

Hey, @Fallen-Breath, thanks for reporting! Could you please try the latest version (4.0.0)?

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

No branches or pull requests

2 participants