Interview Prep/GitHub Actions/Expressions, Outputs, Matrix & Conditions

A notification step with `if: always()` posted "failed" even when the run was cancelled by a newer commit.

BeginnerTroubleshootingExpressions, Outputs, Matrix & Conditions
Answer

Likely causes → always() runs on cancel too, and the script assumed non-success meant failure.

Diagnose → Check job.status in the step: cancelled.

Fix → Use if: failure() for failure alerts, or if: ${{ !cancelled() }} with status-specific messages.

Prevent → Reserve always() for cleanup.

All GitHub Actions questions Roadmap: GitHub Actions

More on Expressions, Outputs, Matrix & Conditions