Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.72 KB

05.4.2_outputs.md

File metadata and controls

50 lines (36 loc) · 1.72 KB

Outputs {docsify-ignore-all}

This is an optional parameter used when your action needs to pass data to another action later in the workflow. Consider an action that makes a specific HTTP request and needs to send the response of that request to an operation later in the workflow chain. This is where outputs come into play.

Like Inputs the outputsof an action get declared in the action.yml like below:

action.yml

outputs:
  res:
    description: response object from super fancy HTTP request

outputs get named, in the above scenario that name is res and they have one parameter which is description.

As you expect, actions can have more than one output and defining them is as easy as adding to the outputs block.

action.yml

outputs:
  res:
    description: response object from super fancy HTTP request
  anotheroutput:
    description: see, you really can use more than one output

description is required if you plan to define outputs for your action.

Let's take a look 👀at how to use outputs from the workflow side of things.

workflow.yml

steps:
  - name: My first step
    uses: our/custom-action@v1
    id: step1
  - name: My backup step
    uses: any/action-expecting-input@v1
    with:
      expectedinput: ${{steps.step1.outputs.res}}

Take notice that the expectedinput uses a specific output named res. It was in the action.yml file that res was defined. So like inputs, we can check the action.yml file for any given action to see what kind of outputs this action is capable of passing down throughout your workflows.

👈Continue to learn about the Entrypoint requirement in the action.yml file!