Chaining Jobs #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Chaining Jobs | |
on: | |
workflow_dispatch: | |
inputs: | |
run-job-3: | |
description: "Run job 3" | |
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" | |
job-3: | |
name: Job 3 | |
if: github.event.inputs.run-job-3 == 'true' # if the input is false, this job would be skipped | |
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() # Causes the job to always execute | |
needs: | |
- job-2 | |
- job-3 | |
steps: | |
- name: Output for Job 4 | |
run: echo "Hello from Job 4" |