Fix and improve jobs.yml workflow #2
This file contains hidden or 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: "Dependent Jobs Example" | |
| on: | |
| push: | |
| branches: [ main ] | |
| workflow_dispatch: # Allow manual triggering | |
| jobs: | |
| job1: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Job 1 Step" | |
| run: | | |
| echo "Hello from Job 1" | |
| echo "status=success" >> $GITHUB_OUTPUT | |
| job2: | |
| runs-on: ubuntu-latest | |
| needs: job1 | |
| steps: | |
| - name: "Job 2 Step" | |
| run: echo "World from Job 2" | |
| - name: "Show Job 1 Output" | |
| if: ${{ needs.job1.result == 'success' }} | |
| run: echo "Job 1 completed successfully!" | |
| - name: "Continue with Job 2" | |
| run: | | |
| echo "Performing Job 2 tasks..." | |
| echo "All tasks completed successfully!" |