File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- name : " Dep Jobs Example"
1+ name : " Dependent Jobs Example"
22
33on :
44 push :
55 branches : [ main ]
6+ workflow_dispatch : # Allow manual triggering
7+
68jobs :
7- job1 :
8- runs-on : ubuntu-latest
9- steps :
10- - name : " Job 1 Step"
11- run : echo "Hello"
12- job2 :
13- runs-on : ubuntu-latest
14- needs : job1
15- steps :
16- - name : " Job 2 Step"
17- run : echo "World"
18- - name : " Show Job 1 Output"
19- run : echo "Job 1 completed successfully!"
20- if : ${{ needs.job1.result == 'success' }}
21- - name : " Failing Step in Job 2"
22- run : exit 1
9+ job1 :
10+ runs-on : ubuntu-latest
11+ steps :
12+ - name : " Job 1 Step"
13+ run : |
14+ echo "Hello from Job 1"
15+ echo "status=success" >> $GITHUB_OUTPUT
16+
17+ job2 :
18+ runs-on : ubuntu-latest
19+ needs : job1
20+ steps :
21+ - name : " Job 2 Step"
22+ run : echo "World from Job 2"
23+
24+ - name : " Show Job 1 Output"
25+ if : ${{ needs.job1.result == 'success' }}
26+ run : echo "Job 1 completed successfully!"
27+
28+ - name : " Continue with Job 2"
29+ run : |
30+ echo "Performing Job 2 tasks..."
31+ echo "All tasks completed successfully!"
You can’t perform that action at this time.
0 commit comments