Reusable workflows and job status check functions

I’ve been trying to narrow down some weird behavior in a reusable workflow. It seems that when status check functions such as success() and failure() are used within a reusable workflow, they are evaluated only against the jobs within the called workflow, and not the calling one.

Taking this workflow run as an example, you’ll see that one job in the calling workflow fails, but the conditional check in the called workflow for a failure is not evaluating to true.

I’ve done some other testing, and this is true even when the if contains a single job status check function.

Is this intentional? If so, could this be detailed in the documentation. And are there any ways to check or pass along the status of the calling workflow?

“When a reusable workflow is triggered by a caller workflow, the github context is always associated with the caller workflow.”

Based on this I had assumed that all expression evaluation would function as it would in the calling workflow.

In case anyone else encounters this, we’ve implemented a temporary fix for this by passing the calling workflow’s status to the called one as an input.

This is not ideal (especially when there are multiple jobs within the calling workflow), but it allows accurate status checks.