cake-build / cake-action

:cake::octocat: Run Cake (C# Make) scripts in your GitHub Actions workflows.
https://cakebuild.net
MIT License
45 stars 13 forks source link

Allow to specify configuration argument as input #10

Closed dmagnanimo closed 4 years ago

dmagnanimo commented 4 years ago

It will be best practice to insert configration argument as input. Example:

steps:
  - name: Run the Cake script
    uses: ecampidoglio/cake-action@master
    with:
      configuration: Release
ecampidoglio commented 4 years ago

Parameters like configuration don't belong to Cake itself, but rather are defined in the particular Cake script that you're running.

While we could add support for the most commonly used arguments (like configuration), I would rather implement a way to pass custom arguments from the workflow to the Cake script.

Ideally, we'd define an input parameter called scriptArguments that accepts a YAML sequence, so we can say:

steps:
  - name: Run the Cake script
    uses: cake-contrib/cake-action@v1
    with:
      scriptArguments:
        - configuration: Release
        - someOtherParameter: value
        - whyNotASwitch: true

Sounds good right? But here's the problem: actions don't support sequences as inputs, or anything other than string, really. 😞

The current workaround is to define a custom format for lists and parse that manually. Some use embedded JSON, while others simply define each input in a new line.

I'm looking into both solutions while watching actions/toolkit#184 closely.

dmagnanimo commented 4 years ago

The scriptArguments input parameter looks good indeed, for now I'll use one of the workaround you suggest. Thanks.

jwickowski commented 4 years ago

There is a pull request that will alow for that :)

https://github.com/cake-build/cake-action/pull/20

ecampidoglio commented 4 years ago

Until it's possible to parse input arguments as lists, you can pass the configuration parameter to your Cake script by using the new arguments input:

steps:
  - name: Run the Cake script
    uses: cake-build/cake-action@master
    with:
      arguments: |
        configuration: Release
ecampidoglio commented 4 years ago

Resolved in 49c1c65.