Skip to content

How can you expand context that is passed in via an output #25355

Answered by Ajibola
Ajibola asked this question in Actions
Discussion options

You must be logged in to vote

Thanks @yanjingzhu for the detailed response, it was really helpful. Seeing that the expansion is essentially a format() call, I used that idea to substitute in the placeholders.

env:
        MSG_TEMPLATE: ${{ format(steps.gettemplate.outputs.msg, github.workflow, job.status) }}

The json needed to be escaped in order for format() to work as per the docs, so it ended up looking like this

{{“text”:“Workflow Results for : {0} {1}”}}

I think it might be better using sed to escape the curly braces in a json automatically and using format() for the substitution

How were you able to see the debug info?, it is quite handy for knowing what is happening under the hood.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
2 participants