Toolkit: Document the equivalent of core.exportVariable for Docker actions

Created on 16 Aug 2019  路  5Comments  路  Source: actions/toolkit

Hello,

I'm sorry if this is not the best place to ask this, I've looked if there aren't already communities more "support-oriented", but as GitHub actions is still in beta, it seems this question hasn't been properly settled yet.

There's a core.exportVariable method which allows one to _"export variables and secrets for future steps"_. However, I haven't found a way to do the same thing with a Docker action.
I (na茂vely) tried adding something like export MY_VAR='tada' to the entrypoint.sh file from the template, but I am unable to read the variable from a subsequent step.

  • Is there an equivalent of exportVariable for Docker actions? If so, I think it should be documented in the template. If not, it should also be documented 馃槃

Thanks for your help!

All 5 comments

I'm sorry if this is not the best place to ask this

This is a great place!

Is there an equivalent of exportVariable for Docker actions?

Well, if you run javascript in the container you can call exportVariable with this library and it should work. Otherwise, you should be able to replicate what we do in our exportVariable function by doing something like echo "::[set-env name=FOO;]BAR", which will set FOO=BAR in the env for future steps.

Note that docs for this are tracked in #57 and that this doesn't match exactly what exportVariable does yet because of #59

Actually, scratch that - for now you should still use echo "##[set-env name=FOO;]BAR". Note though, that we're going to replace ## with :: in the near future and ## will be (gracefully) deprecated.

I can confirm this is working @damccorm , thanks for your help :)

Awesome! I'm going to close here and follow up in #57

Closing since we have docs as of #105 (and I said I'd close 2 weeks ago 馃槼)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

josephperrott picture josephperrott  路  6Comments

warrenbuckley picture warrenbuckley  路  6Comments

KeisukeYamashita picture KeisukeYamashita  路  4Comments

Kerizer picture Kerizer  路  4Comments

JamesIves picture JamesIves  路  5Comments