Reusable workflow doesn't output the individual job `result`
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
Description
Describe the bug
When using a reusable workflow and outputting the result of a job, the value resolves to an empty string.
To Reproduce
Create a caller workflow
name: Caller Workflow
on: [pull_request]
jobs:
call:
uses: ./.github/workflows/reusable.yml
print_result:
needs: call
if: always()
runs-on: ubuntu-latest
steps:
- name: Run
run: |
echo "${{ toJSON(needs.call.outputs.pass) }}"
echo "${{ toJSON(needs.call.outputs.fail) }}"
Create a reusable workflow reusable.yml
name: Reusable
on:
workflow_call:
outputs:
pass:
value: ${{ jobs.pass.result }}
fail:
value: ${{ jobs.fail.result }}
jobs:
fail:
runs-on: ubuntu-latest
steps:
- run: exit 1
pass:
runs-on: ubuntu-latest
steps:
- run: exit 0
Expected behavior
The result to always be outputted from the reusable workflow.
Actual behaviour
The outputs (or results) resolve as empty strings.
Workaround
Oddly enough, it appears you can get the results to resolve when adding another mock output that uses a toJSON() expression, such as:
on:
workflow_call:
outputs:
pass:
value: ${{ jobs.pass.result }}
fail:
value: ${{ jobs.fail.result }}
mock:
value: ${{ toJSON(jobs.fail).result }}
Which results in the following being printed:
success
failure
Note that we are not even consuming that mock output.
Alternatively, you can wrap an output with toJSON and fromJSON and it will resolve:
pass:
value: ${{ fromJSON(toJSON(jobs.pass)).result }}
Feels like an async process isn't being awaited unless the outputs need to convert with an expression.
Runner Version and Platform
Version of your runner? GitHub Enterprise Cloud
OS of the machine running the runner? OSX/Windows/Linux/...ubuntu-latest
What's not working?
Without the toJSON output

With the toJSON output

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the behavior with the caller workflow and reusable.yml examples, comparing direct jobs..result outputs with the toJSON/fromJSON variants. Confirm that pass and fail resolve to success and failure without a mock or conversion; the issue does not name a source file or test entry point.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100