Martijn Dirkse
Martijn Dirkse

Reputation: 677

How to access step output within github-script action

I would like to use the output of a previous step in a github-script action. I tried:

    - name: Print step result
      uses: actions/github-script@v6
      with:
        script: |
          core.info(`Step result is: ${steps.captureStatus.outputs.response}`)

This gives me an error that steps is not defined.

The preceeding action is:

    - name: Capture status
      id: captureStatus
      uses: fjogeleit/http-request-action@v1
      with:
        method: GET
        url: "http://localhost:8091/iaf/api/server/health"

I read Retrieve the output error from a github actions step, but from the answers on that question I could not find the answer of the present question.

Any ideas?

Upvotes: 1

Views: 6210

Answers (1)

Matteo
Matteo

Reputation: 39390

You should use double curly brackets, so try

          core.info(`Step result is: ${{steps.captureStatus.outputs.response}}`)

instead of

          core.info(`Step result is: ${steps.captureStatus.outputs.response}`)

Upvotes: 4

Related Questions