github-workflows-kt icon indicating copy to clipboard operation
github-workflows-kt copied to clipboard

[Bug] encoding multi-line values does not work properly

Open Vampire opened this issue 1 year ago • 1 comments

Action

run(
    condition = """
        always()
        && (steps.${executeAction.id}.outcome == 'success')
    """.trimIndent(),
    command = "true"
)

Expected

No exception

Actual

[...]
      - id: step-2
        run: true
        if: always()
      && (steps.step-1.outcome == 'success')
[...]
com.charleskorn.kaml.MalformedYamlException at jobs.test_default_distribution.steps[2] on line 100, column 8: while scanning an anchor
 at line 100, column 7:
          && (steps.step-1.outcome == 'success')
          ^
unexpected character found &(38)
 at line 100, column 8:
          && (steps.step-1.outcome == 'success')
           ^
	at com.charleskorn.kaml.YamlParser.translateYamlEngineException(YamlParser.kt:89)

Workaround, if exists

run(
    condition = """
        always()
            && (steps.${executeAction.id}.outcome == 'success')
    """.trimIndent(),
    command = "true"
)

Library version

v0.23.0

Vampire avatar Jul 28 '22 20:07 Vampire

See https://github.com/krzema12/github-actions-kotlin-dsl/issues/80#issuecomment-1200504222, it will be fixed in scope of that task.

krzema12 avatar Jul 31 '22 21:07 krzema12

After addressing #80, it's now encoded properly by snakeyaml.

krzema12 avatar Aug 14 '22 22:08 krzema12