Problem when building an action with docker, i want to set some outputs of my action but i can’t find some document about how to set output of an action inside a container.
By just send some message to stderr/stdout ? Is there some format of output that i should follow?
Please give some help! Thank you!
Hi @jonyhy96 ,
Thank you for being here!
You can refer to the doc here to check the docker action example for the output setting.
In the action.yaml datameta file, define output:
time: # id of output
description: ‘The time we greeted you’
In the entrypoint.sh file, you must use a workflow command in a specific syntax: echo “::set-output name=<output name>::<value>”
echo “::set-output name=time::$time”
Hope it helps!
Thanks for help!
I already know that we can use
echo "::set-output name=\<output name\>::\<value\>" inside an entrypoint.sh to declare an output.
I wanna to know what if i don’t use entrypoint.sh but use a binary(written in golang) to handle the input. How can i set the output of the action by the binary? By execute a shell command(::set-output name=<output name>::<value>) inside my binary? What is the principle of ::set-output ?
> By execute a shell command(::set-output name=<output name>::<value>) inside my binary?
No, that’s not a shell command - that’s the parameter to
echo. By printing that string to stdout, the GitHub Actions runner will store that name/value pair in the output context for that step. eg, in Go:
> By just send some message to stderr/stdout ?
Yes, send these commands to stdout.
> Is there some format of output that i should follow?
Yes, they’re documented here: https://help.github.com/en/actions/reference/workflow-commands-for-github-actions