Skip to content

Chaining Jobs

Chaining Jobs #5

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-2:
description: "Run job 2"
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
if: github.event.inputs.run-job-2 == 'true'
runs-on: ubuntu-latest
needs:
- job-1
steps:
- name: Output for Job 2
run: echo "Hello from Job 2"
job-3:
name: Job 3
runs-on: ubuntu-latest
needs:
- job-2
steps:
- name: Output for Job 3
run: echo "Hello from Job 3"
job-4:
name: Job 4
#if: ${{ always() }}
runs-on: ubuntu-latest
#needs:
# - job-2
# - job-3
steps:
- name: Output for Job 4
run: echo "Hello from Job 4"