Using the output of `run:` inside of `if:` condition?

Is there any way to get the output of a run: script into the if: condition? The feature I’m basically looking for is a step output from run: but that doesn’t look possible according to the documentation.

I’ve already gone the route of writing my own action to make a step with an output but it took a _lot_ of boilerplate because I needed to reauth with GitHub in the action, checkout the repository again, and do all my checks again in the action. I would have used actions/github-script but unfortunately the auth mechanism doesn’t currently meet my use case and it seemed if I had access to run: stuff inside if: this whole thing would’ve been much easier to accomplish

1 Like
- id: id
  run: echo ::set-output name=key::value
- if: steps.id.outputs.key == 'value'

This should work.

5 Likes