Skip to content

Chaining Jobs

Chaining Jobs #1

Workflow file for this run

# Display name of workflow
name: Chaining Jobs
# Controls when the action will run. Workflow runs when manually triggered using the UI or API.
on:
workflow_dispatch:
# Inputs the workflow accepts.
inputs:
run-job-3:
description: "Run job 3"
required: true
type: boolean
jobs:
job-1:
name: Job 1
runs-on: ubuntu-latest
steps:
- name: Output for Job 1
run: echo "Hello from Job 1. Run Job 3 equals ${{ github.event.inputs.run-job-3 }}"
job-2:
name: Job 2
runs-on: ubuntu-latest
needs:
- job-1
steps:
- name: Output for Job 2
run: echo "Hello from Job 2"
#- name: Make Job 2 Fail
# run: exit 1
job-3:
name: Job 3
if: github.event.inputs.run-job-3 == 'true'
runs-on: ubuntu-latest
needs:
- job-1
steps:
- name: Output for Job 3
run: echo "Hello from Job 3"
job-4:
name: Job 4
runs-on: ubuntu-latest
# if: always()
needs:
- job-2
- job-3
steps:
- name: Output for Job 4
run: echo "Hello from Job 4"