30 / 48 · 16 CI/CD Pipelines · Pipeline Optimization← prev⊞ allnext →☰ Read as one page
5.5Conditional Execution
Skip expensive work when it is not needed.
Path-Based Filtering
# Skip tests when only documentation changed
on:
push:
paths-ignore:
- '**.md'
- 'docs/**'
- '.github/ISSUE_TEMPLATE/**'
- 'LICENSE'
# Only run backend tests when backend code changed
on:
push:
paths:
- 'src/api/**'
- 'src/services/**'
- 'tests/integration/**'
Job-Level Conditions
# Only run browser tests on PRs targeting main
browser-tests:
if: github.event_name == 'pull_request' && github.base_ref == 'main'
# Skip expensive tests for draft PRs
e2e-tests:
if: github.event.pull_request.draft == false
Step-Level Conditions
# Only upload artifacts on failure
- uses: actions/upload-artifact@v4
if: failure()
# Only run deployment on main branch
- run: npm run deploy
if: github.ref == 'refs/heads/main'