1

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?

1 Answer 1

4

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}`)

Sign up to request clarification or add additional context in comments.

1 Comment

This works but is a security issue if the output is not fully in your control: the double-curly-expansion can lead to remote code execution. A safer choice is to map the output to a environment variable and use that variable instead

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.