Open benjaminmal opened 9 months ago
Hey!
I had a similar issue when I was trying to grab an output from a reusable workflow. My problem was that I was only defining the outputs in the job and not at the top level of the workflow. Your post helped me find what I was missing. You seem to maybe have the opposite happening - only the outputs defined at the top level and not in the job, however it's missing the 'outputs' call. It looks like the GitHub output is also not being set in the run command.
Hopefully trying this will help you:
on:
workflow_call:
outputs:
result:
value: ${{ jobs.build.outputs.result }} # set this to call on the result value in the outputs in the build job
jobs:
build:
runs-on: ubuntu-latest
outputs:
result: ${{ steps.hello-world.outputs.result}} # Define the output here with using the step id
steps:
- id: hello-world # provide an id to the step you are wanting to call on
run: |
result='hello world!'
echo "result=$result" >> $GITHUB_OUTPUT # Set the variable as GitHub output
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
fromon.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:
Caller workflow file:
Expected behavior
jobs.<job_id>.result
must beskipped
, I've got an empty stringRunner Version and Platform
Version of your runner?
2.311.0
GitHub HostedOS of the machine running the runner?
ubuntu-latest
What's not working?
Doing (reusable workflow):
And (caller workflow):
Print:
Workaround
I found an interesting workaround:
Works perfectly. I can access it in my caller workflow: