Skip to content

Optionally unwrap an output #17

@jenseng

Description

@jenseng

By default, dynamic-uses returns a single JSON output named outputs containing all the target action's outputs. Individual outputs can then be accessed via something like fromJSON(steps.cool-action.outputs.outputs).theThingIWant. This provides the most flexibility.

But sometimes you just want a single output, and if you have to do this in multiple expressions this can get a bit tedious/verbose. It would be nice if you could optionally specify a particular output to target, then the outputs output would contain its actual value.

e.g. instead of this

- id: cool-action
  uses: jenseng/dynamic-uses@v1
  with:
    uses: my/cool/action@${{ inputs.version }}
- env:
    theThing: ${{ fromJSON(steps.cool-action.outputs.outputs).theThingIWant }}
  run: echo "$theThing"

you could do something like this:

- id: cool-action
  uses: jenseng/dynamic-uses@v1
  with:
    uses: my/cool/action@${{ inputs.version }}
    output: theThingIWant
- env:
    theThing: ${{ steps.cool-action.outputs.outputs }}
  run: echo "$theThing"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions