Skip to content

Commit 0e38f27

Browse files
Fix and improve jobs.yml workflow
1 parent c0dccff commit 0e38f27

1 file changed

Lines changed: 26 additions & 17 deletions

File tree

.github/workflows/jobs.yml

Lines changed: 26 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,31 @@
1-
name: "Dep Jobs Example"
1+
name: "Dependent Jobs Example"
22

33
on:
44
push:
55
branches: [ main ]
6+
workflow_dispatch: # Allow manual triggering
7+
68
jobs:
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!"

0 commit comments

Comments
 (0)