Cannot access `jobs.<job_id>.result` from `on.workflow_call.outputs.<output_id>.value`
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
I'm trying to set an output in my reusable workflow of the result of a job but can't access to jobs.<job_id>.result from on.workflow_call.outputs.<output_id>.value. I have a empty string. As stated in docs, I should be able to access it. I can correctly access my output from my caller workflow.
To Reproduce
Reusable workflow file:
on:
workflow_call:
outputs:
result:
value: ${{ jobs.build.result }}
jobs:
build:
if: 'true' == 'false' # Makes skip the job
runs-on: ubuntu-latest
steps:
- run: echo 'hello-world!'
Caller workflow file:
on:
push: ~
jobs:
build:
uses: ./.github/workflows/build.yaml
secrets: inherit
deploy:
needs: build
uses: ./.github/workflows/deploy.yaml
if: needs.build.outputs.result == 'skipped'
secrets: inherit
Expected behavior
jobs.<job_id>.result must be skipped, I've got an empty string
Runner Version and Platform
Version of your runner? 2.311.0 GitHub Hosted
OS of the machine running the runner? ubuntu-latest
What's not working?
Doing (reusable workflow):
on:
workflow_call:
outputs:
result:
value: ${{ toJSON(jobs.build) }}
And (caller workflow):
on:
push: ~
jobs:
debug:
needs: build
steps:
- run: echo ${{ needs.build.outputs.result }}
Print:
Workaround
I found an interesting workaround:
on:
workflow_call:
outputs:
result:
value: ${{ fromJSON(toJSON(jobs.build)).result }}
Works perfectly. I can access it in my caller workflow:
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
Start by reproducing the reusable workflow and caller workflow shown in the issue on the GitHub Actions runner, focusing on workflow_call output expression evaluation for the jobs context. Compare direct jobs.build.result access with the documented toJSON/fromJSON workaround. Done means the output resolves to skipped without the workaround and remains available to the caller workflow.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, github-actions
- Domain
- ci-cd, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100