CICD-222 · Dependency-aware execution
Encyclopedia · Advanced workflow orchestration · All snippets
Previous · CICD-221 · Next · CICD-223
1. Where it fits
- Placement .github/workflows/ci.yml consumer job fragment.
- Prerequisites authenticated GitHub CLI, approved target repositories, or Actions runner for YAML entries.
- Platforms github-actions.
2. Copy the snippet
yaml
needs: [build, test]
if: ${{ !cancelled() && needs.build.result == 'success' && needs.test.result == 'success' }}3. How it works
The explicit condition can inspect both dependency results even on failure. Only successful build and test results admit the downstream work.
4. Verify the result
The gate observes both dependency results and only launches when both are successful.
Validation syntax-validated (YAML parse). Status definitions.