Skip to content

Instantly share code, notes, and snippets.

@mbjelac
Created December 19, 2023 17:02
Show Gist options
  • Save mbjelac/8e7dd5c548fc18041062f0e174245034 to your computer and use it in GitHub Desktop.
Save mbjelac/8e7dd5c548fc18041062f0e174245034 to your computer and use it in GitHub Desktop.
How to reference step output in a subsequent step if clause
name: Test step output
on:
workflow_dispatch:
inputs:
fail_value:
description: 'Should fail on > 40'
required: true
type: number
default: 0
jobs:
fail-on-step-output:
runs-on: ubuntu-latest
steps:
- name: set some output
id: out
run: echo "foo=${{ inputs.fail_value }}" >> $GITHUB_OUTPUT
- name: fail on output
if: steps.out.outputs.foo > 40
run: exit 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment