How to let users pass YAML to the action?

Hi!

I’ve got an action that runs a tool that is configured via a YAML file. At the moment the action provides a default YAML config file and allows users to overwrite a few specific configuration options via action inputs.

However, given that it’s not feasible to create an input for every possible configuration option, I would like to let users somehow provide YAML data that would be then merged with the default config using yq tool.

How can I let users provide this custom YAML config? Not sure how much it matters, but my action uses a Dockerfile.

Looks like actions have access to files in the repo, so one can add a file to the repo and then access it e.g. in entrypoint.sh script.

Hi,

I would be also interested in yaml inputs of actions, but your solution isn’t better than my current workaround

This would be great if it would work

- uses: ChristopherHX/conditional@b4a9649204f81002ec9a4ef7d4bf7d6b2ab7fa55
  with:
    if: ${{steps.cacheaction.outputs.cache-hit != 'true'}}
    step:
      uses: actions/setup-node@v2
      with:
        node-version: ${{inputs.nodever}}

My current workaround is:

- uses: ChristopherHX/conditional@b4a9649204f81002ec9a4ef7d4bf7d6b2ab7fa55
  with:
    if: ${{steps.cacheaction.outputs.cache-hit != 'true'}}
    step: |
      uses: actions/setup-node@v2
      with:
        node-version: ${{inputs.nodever}}

I get trouble once ${{inputs.nodever}} contains newlines or need yaml escaping, which would be no problem with object inputs of my composite action ( or reusable workflows )

BTW actions runner currently allows unknown inputs of actions, this means you can pass arbitary yaml inputs in the input dictionary of with and get every one as INPUT_NAME_OF_YOUR_INPUT environment variable or in the inputs context of composite actions, the only drawback is you get a warning about such undeclared inputs in your log.