Skip to main content

At the time of writing this answer, GitHub Actions doesn't support array types as input for actions. It only supports string | number | boolean (schema: withwith ref: definitions/envdefinitions/env). So your approach is a valid workaround for now.

Just note that GithubGitHub runners have jq installed by default, and GitHub Actions offers methods like fromJSONfromJSON, toJSON and joinjoin, which may help you create a cleaner solution in case you want to generate a dynamic input of your custom action.

You can check google-github-actions/get-secretmanager-secrets's implementation where they accept multiple inputs specified by line breaks, not as a yaml array:

- id: 'secrets'
  uses: 'google-github-actions/get-secretmanager-secrets@v1'
  with:
    secrets: |-
      token:my-project/docker-registry-token
      anotherOne:my-project/a-secret
      anotherOneToo:my-project/another-secret
    - id: 'secrets'
      uses: 'google-github-actions/get-secretmanager-secrets@v1'
      with:
        secrets: |-
          token:my-project/docker-registry-token
          anotherOne:my-project/a-secret
          anotherOneToo:my-project/another-secret

Definitely, this might not be what you want to achieve. And it might not be worth refactoring your action. But it's a workaround for now.

At the time of writing this answer, GitHub Actions doesn't support array types as input for actions. It only supports string | number | boolean (schema: with ref: definitions/env). So your approach is a valid workaround for now.

Just note that Github runners have jq installed by default, and GitHub Actions offers methods like fromJSON, toJSON and join, which may help you create a cleaner solution in case you want to generate a dynamic input of your custom action.

You can check google-github-actions/get-secretmanager-secrets's implementation where they accept multiple inputs specified by line breaks, not as a yaml array:

- id: 'secrets'
  uses: 'google-github-actions/get-secretmanager-secrets@v1'
  with:
    secrets: |-
      token:my-project/docker-registry-token
      anotherOne:my-project/a-secret
      anotherOneToo:my-project/another-secret

Definitely, this might not be what you want to achieve. And it might not be worth refactoring your action. But it's a workaround for now.

At the time of writing this answer, GitHub Actions doesn't support array types as input for actions. It only supports string | number | boolean (schema: with ref: definitions/env). So your approach is a valid workaround for now.

Just note that GitHub runners have jq installed by default, and GitHub Actions offers methods like fromJSON, toJSON and join, which may help you create a cleaner solution in case you want to generate a dynamic input of your custom action.

You can check google-github-actions/get-secretmanager-secrets's implementation where they accept multiple inputs specified by line breaks, not as a yaml array:

    - id: 'secrets'
      uses: 'google-github-actions/get-secretmanager-secrets@v1'
      with:
        secrets: |-
          token:my-project/docker-registry-token
          anotherOne:my-project/a-secret
          anotherOneToo:my-project/another-secret

Definitely, this might not be what you want to achieve. And it might not be worth refactoring your action. But it's a workaround for now.

Source Link
Fcmam5
  • 7.3k
  • 1
  • 26
  • 44

At the time of writing this answer, GitHub Actions doesn't support array types as input for actions. It only supports string | number | boolean (schema: with ref: definitions/env). So your approach is a valid workaround for now.

Just note that Github runners have jq installed by default, and GitHub Actions offers methods like fromJSON, toJSON and join, which may help you create a cleaner solution in case you want to generate a dynamic input of your custom action.

You can check google-github-actions/get-secretmanager-secrets's implementation where they accept multiple inputs specified by line breaks, not as a yaml array:

- id: 'secrets'
  uses: 'google-github-actions/get-secretmanager-secrets@v1'
  with:
    secrets: |-
      token:my-project/docker-registry-token
      anotherOne:my-project/a-secret
      anotherOneToo:my-project/another-secret

Definitely, this might not be what you want to achieve. And it might not be worth refactoring your action. But it's a workaround for now.