Job deploy should run only when job test succeeds, but job notify should run if test fails or succeeds (not when cancelled). Which pair of if: expressions is appropriate?
Select an answer to reveal the explanation.
Short Explanation and Infographic
Check needs.test.result for precise outcomes. always() lets notify run after failure; filter out cancelled. failure() on deploy is backwards; event_name alone is not a test gate.
Full explanation below image
Full Explanation
When jobs declare needs: test, you can branch on needs.test.result values: success, failure, cancelled, or skipped. Deploy-to-prod almost always requires == 'success'. Notification or cleanup jobs often use always() so they are not skipped when a prior needed job fails, then exclude cancelled runs if you do not want noise from manual cancels. Putting failure() on deploy would run deploy only when the job context is failure—usually the opposite of intent. github.event_name alone does not encode test outcomes. success() without a correct needs relationship may not express multi-job dependency intent clearly when multiple upstream jobs exist; explicit needs and result checks scale better. Remember a job with needs that is skipped can cascade skips—use if: carefully on the dependency graph.