Skip to content

Workflow Logic Test

Workflow Logic Test #8

name: Workflow Logic Test
run-name: Workflow Logic Test
on:
workflow_dispatch:
inputs:
fail-job-2:
description: 'Job2 should fail?'
type: boolean
required: true
permissions:
contents: read # This is required for actions/checkout
jobs:
job1:
name: Job 1
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
job2:
name: Job 2
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Fail Job = TRUE
if: ${{ github.event.inputs.fail-job-2 == true }}
run: exit 1
- name: Fail Job = FALSE
if: ${{ ! github.event.inputs.fail-job-2 == false }}
run: exit 0
job3:
name: Job 3
runs-on: ubuntu-latest
needs: [job1, job2]
if: ${{ always() }}
steps:
- name: Checkout
uses: actions/checkout@v4
job4:
name: Job 4
runs-on: ubuntu-latest
needs: job3
if: ${{ success() }}
steps:
- name: Checkout
uses: actions/checkout@v4