Skip to content

Support list input type #184

Open

Description

@bryanmacfarlane

Thank you 🙇‍♀ for wanting to create an issue in this repository. Before you do, please ensure you are filing the issue in the right place. Issues should only be opened on if the issue relates to code in this repository.

If your issue is relevant to this repository, please include the information below:

Describe the enhancement
An action should be able to have an input type which is a list of strings. The toolkit should provide a getInput overload or new method to retrieve it.

Code Snippet

let vals: string[] = core.getListInput('inputName');

Additional information
Add any other context about the feature here.

Activity

  1. kiprasmel commented on Feb 6, 2020

    @kiprasmel
    Contributor

    I was going through https://github.com/actions/cache trying to implement multiple path support, and when going through source code, I only noticed the core.getInput function, but not one for core.getInputs to get multiple of them.

    Then, later, I found this:

    const restoreKeys = core
    	.getInput(Inputs.RestoreKeys)
    	.split("\n")
    	.filter(x => x !== "");

    so, is

    let vals: string[] = core.getInput('inputName').split("\n").filter(x => x !== "");

    the official way of doing it?

    If so, I've created a PR to implement this: #336

  2. AB-xdev commented on Aug 31, 2021

    @AB-xdev

    Was this fixed with #829?

  3. asbjornu commented on Jul 28, 2022

    @asbjornu

    @AB-xdev, as far as I can tell, #829 implements support for values spanning multiple lines, not lists. With the implemented core.getMultilineInput() the following should be possible:

    - uses: myaction
      with:
        multiline-param: |
          line1
          line2
          line3

    However, the following is still not possible:

    - uses: myaction
      with:
        list-param: ['item1', 'item2', 'item3']

    Neither is this:

    - uses: myaction
      with:
        list-param:
          - item1
          - item2
          - item3
  4. rickstaa commented on Sep 25, 2022

    @rickstaa

    @asbjornu Good extension! I created #1183 to also implement the second case. Not sure how to implement the last case since these parameters are passed as an environment parameter.

  5. git-developer commented on Aug 6, 2023

    @git-developer

    I'm happy with this workaround posted on StackOverflow:

    1. Definition: Use a property of type string and a literal with the JSON representation of the list, e.g. products: '["yellow", "green"]'
    2. Use: Decode the string literal to a JSON list, e.g. ${{ fromJSON(inputs.products) }}

    Example:

    on:
      workflow_dispatch:
        inputs:
          products:
            description: "List of Products"
            default: '["yellow"]'
          limits:
            description: "List of limits"
            default: '[50]'
    
    jobs:
      build:
        runs-on: ubuntu-latest
        strategy:
          matrix:
            product: ${{ fromJSON(github.event.inputs.products) }}
            limits: ${{ fromJSON(github.event.inputs.limits) }}
  6. Edwardius commented on Oct 18, 2023

    @Edwardius

    can we have this pwease :3

  7. added a commit that references this issue on Oct 19, 2023
    0f7c0ce
  8. sroomberg-ep commented on Mar 27, 2025

    @sroomberg-ep

    Any movement on supporting list inputs?

  9. iamstarkov commented on Apr 9, 2025

    @iamstarkov

    @sroomberg-ep I believe you are looking for getMultilineInput merged from #829

    I also have a pull-request which addresses similar feature request, but it has been unreviewed for few months #1926

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions