[Core feature request] Allow accessing step outputs
See original GitHub issueWhat feature do you need? Please add a link to GitHub docs (https://docs.github.com/en/actions/using-workflows/) which describes the desired feature. https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsid
Do you have an example usage? Best if a YAML snippet is pasted here, or if your project is open-source, an URL to your workflow.
- name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
context: ./
file: ./Dockerfile
push: true
tags: ${{ secrets.DOCKER_HUB_USERNAME }}/discordbot:latest
- name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}
even better would be if we could use it somewhat like so:
fun variable(variable: String): String = "\${{ $variable }}"
val dockerBuild = uses(
name = "Build and push",
id = "docker_build_push",
action = DockerBuildPush(
context = ".",
file = "./Dockerfile",
push = true,
tags = "${variable("secrets.DOCKER_HUB_USERNAME")}/discordbot:latest",
)
)
run(
name = "image digest",
command ="echo ${dockerBuild.outputsVariable("digest")}",
// command = "echo ${variable("steps.${dockerBuild.id}.outputs.digest")}",
)
but just having access to the id field would let me build the command echo ${{ steps.docker_build.outputs.digest }}
myself too
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Core Feature Request - Pabbly Connect
When editing a flow, I want to test multiple data inputs. After changing, not all data gets refreshed. Please change this and automatic...
Read more >Defining outputs for jobs - GitHub Docs
To use job outputs in a dependent job, you can use the needs context. For more information, see "Contexts." Example: Defining outputs for...
Read more >Context Object - AWS Step Functions
This allows your workflows access to information about their specific execution. You can access the context object from the following fields: InputPath.
Read more >Handle inbound or incoming HTTPS calls - Azure Logic Apps
Receive and respond to HTTPS requests sent to workflows in Azure Logic Apps.
Read more >How to get the current branch within Github Actions?
I added a separate step for extracting branch name from $GITHUB_REF and set it to the step output - name: Extract branch name...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
yes the unsafe access way looks good, this could either generate just the
steps.docker_build.outputs.digest
string… or the whole thing not sure if i might want to call more functions on things eg i might want to do call one of these functions https://docs.github.com/en/actions/learn-github-actions/expressions#functions on the output i could imageformat
orjoin
Sure, so I’ll go with
dockerBuild.outputs.digest
approach.I was thinking about making
dockerBuild.outputs.digest
a string that would contain the placeholder, that is${{steps.docker_build.outputs.digest }}
. Would it work for your use case withset-output
? If I’m missing something, I’d appreciate a minimal example in YAML and how would you like to do it in Kotlin DSL.@edit
Now I got your idea about accessing the outputs in an unsafe way. I’ll add API like
${dockerBuild.outputs["yourOutputName"]}
. Does it look good?Yes. I’ll come back with a draft implementation and we can discuss various approaches.