Skip to content

Workflow Logic Test

Workflow Logic Test #3

name: Workflow Logic Test
run-name: Workflow Logic Test
on:
workflow_dispatch:
inputs:
fail-job-2:
description: 'Job2 should fail?'
type: boolean
default: true
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
if: ${{ github.event.inputs.fail-job-2 }}
run: exit 1
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