You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Reusable workflow doesn't output the individual job result #2495
Hi @ruvceskistefan, it appears your response doesn't acknowledge the functionality in question here. I am thoroughly aware of how reusable workflows and their outputs work, this is addressing the issues of returning a job result as an output from the reusable workflow instead of your typical job output. Note the use of ${{ jobs.pass.result }} instead of ${{ jobs.pass.outputs.var}}. This context information found from here.
While it doesn't explicitly have this use case in the documentation, I believe it to be a very viable one. Knowing the result of each job within a reusable workflow has many use cases, one of which I'm currently dealing with. I suggested a theory, that it feels like an async process isn't being awaited until an expression is executed on the outputs of the workflow, which makes the result resolve to an actual value. This would explain why ${{ fromJSON(toJSON(jobs.pass)).result }} actually works as expected.
If you have any more questions let me know and I'll try to help.
HI @ruvceskistefan Testing your code, I have one issue sharing variables in reusable workflows. If I add a new Job second_job, I am not able to read outputs from job example_job. Not sure what i am doing wrong , but please take a look and tell me how if exist any workaround to share variables between Jobs in a reushable workflow.
name: Reusable
on:
workflow_call:
# Map the workflow outputs to job outputs
outputs:
firstword:
description: "The first output string"
value: ${{ jobs.example_job.outputs.output1 }}
secondword:
description: "The second output string"
value: ${{ jobs.example_job.outputs.output2 }}
jobs:
example_job:
name: Generate output
runs-on: ubuntu-latest
# Map the job outputs to step outputs
outputs:
output1: ${{ steps.step1.outputs.firstword }}
output2: ${{ steps.step2.outputs.secondword }}
steps:
- id: step1
run: echo "firstword=hello" >> $GITHUB_OUTPUT
- id: step2
run: echo "secondword=world" >> $GITHUB_OUTPUT
second_job:
name: Read output
runs-on: ubuntu-latest
steps:
- id: step3 # Outputs not available
run: |
echo "All message: ${{needs.example_job.outputs.firstword}} ${{needs.example_job.outputs.secondword}}"
- id: step4 # Outputs not available
run: |
echo "All message: ${{ needs.job1.outputs.firstword }} ${{ needs.job1.outputs.secondword }}"
Just wanted to share a workaround that works today (as of 2025):
While we still can't return outputs from reusable workflows, you can control downstream jobs based on their success or failure using the built-in success() or failure() functions:
This won’t give you dynamic values from call-build, but it does allow conditional logic based on status, which is often good enough for chaining workflows.
Activity
ruvceskistefan commentedon Mar 21, 2023
Hey @landon-martin, here is how you can set up caller and reusable files
Also you can read more about it here.
If you have any more questions let me know and I'll try to help.
landon-martin commentedon Mar 21, 2023
Hi @ruvceskistefan, it appears your response doesn't acknowledge the functionality in question here. I am thoroughly aware of how reusable workflows and their outputs work, this is addressing the issues of returning a job
resultas an output from the reusable workflow instead of your typical joboutput. Note the use of${{ jobs.pass.result }}instead of${{ jobs.pass.outputs.var}}. This context information found from here.While it doesn't explicitly have this use case in the documentation, I believe it to be a very viable one. Knowing the result of each job within a reusable workflow has many use cases, one of which I'm currently dealing with. I suggested a theory, that it feels like an async process isn't being awaited until an expression is executed on the outputs of the workflow, which makes the result resolve to an actual value. This would explain why
${{ fromJSON(toJSON(jobs.pass)).result }}actually works as expected.chivakaa commentedon Apr 25, 2023
HI @ruvceskistefan Testing your code, I have one issue sharing variables in reusable workflows. If I add a new Job
second_job, I am not able to read outputs from jobexample_job. Not sure what i am doing wrong , but please take a look and tell me how if exist any workaround to share variables between Jobs in a reushable workflow.Echo is emply:
jian-guo-db commentedon Sep 12, 2023
I am experiencing the same as described by @landon-martin
Any resolution?
smk692 commentedon Jun 19, 2024
"Hello. I'm still having an issue, so is there anyone who knows a solution to this problem?"
svenboogaart commentedon Feb 20, 2025
Any update?
taqim2708 commentedon Jun 10, 2025
Just wanted to share a workaround that works today (as of 2025):
While we still can't return outputs from reusable workflows, you can control downstream jobs based on their success or failure using the built-in
success()orfailure()functions:This won’t give you dynamic values from
call-build, but it does allow conditional logic based on status, which is often good enough for chaining workflows.Hope this helps someone!
fix(workflows): resolve reusable workflow output bug
ci: dispatch docker-publish instead of calling it as a reusable workflow
ci(main-check): require always() on the publish-recipes gate; documen…