toolkit icon indicating copy to clipboard operation
toolkit copied to clipboard

feat(core): handle comma seperated lists in getMultilineInput

Open rickstaa opened this issue 3 years ago • 3 comments

This PR makes sure that the core.getMultilineInput function can also parse comma-separated lists (i.e. [val1,val2,val3] and val1,val2,val3).

Fixes https://github.com/actions/toolkit/issues/184#issuecomment-1198653452.

rickstaa avatar Sep 25 '22 07:09 rickstaa

any update on this?

DmitriyBobrovskiy avatar Nov 26 '22 10:11 DmitriyBobrovskiy

It would be better to put this in a new function core.getCommaSeparatedInput() or core.getJsonInput().

People might already be using core.getMultilineInput() with list items that contain commas, so it's not safe to start treating commas as a list separator retrospectively.

- uses: myaction
  with:
    multiline-param: |
      item1, with comma
      item2 no comma
      item3, with, several, commas

This list has 3 items according to the current implementation, but your code would parse it as 7 items, potentially breaking the workflow.

shoogle avatar Sep 03 '23 14:09 shoogle

It would be better to put this in a new function core.getCommaSeparatedInput() or core.getJsonInput().

People might already be using core.getMultilineInput() with list items that contain commas, so it's not safe to start treating commas as a list separator retrospectively.

- uses: myaction
  with:
    multiline-param: |
      item1, with comma
      item2 no comma
      item3, with, several, commas

This list has 3 items according to the current implementation, but your code would parse it as 7 items, potentially breaking the workflow.

Good comment 👍🏻! I've opened issue #1566 to tackle your concerns. Regarding getCommaSeparatedInput, we could also introduce a more versatile getJsonInput function. Unfortunately, I do not have the time right now to implement this 😅.

rickstaa avatar Oct 19 '23 15:10 rickstaa

@rickstaa I implemented the core.getListInput (comma or new lines separated) in #1926, so if you dont have time to implement it yourself you can review the mentioned PR

iamstarkov avatar Apr 09 '25 20:04 iamstarkov