Supporting $GITHUB_ENV besides "::set-output ..."
At the moment, I have to do this to get output out of the container:
echo "::set-output name=${var_name}::${var_value}"
Would it be possible to support $GITHUB_ENV somehow?
echo "${var_name}=${var_value}" >> $GITHUB_ENV
Without $GITHUB_ENV, I have to manually repack variables for follow-up scripts like this:
- name: Export variables from "some-id" docker step
run: |
echo "FIRST=${{ steps.some-id.outputs.FIRST}}" >> $GITHUB_ENV
echo "SECOND=${{ steps.some-id.outputs.SECOND}}" >> $GITHUB_ENV
So that I can then call scripts like this:
- name: Follow-up scripts
run: echo "Hello $FIRST World $SECOND !"
Hi, please upgrade to 2.1.1 and let me know if everything works as expected, thanks!
It's not yet working. I did a small test:
jobs:
test-github-env:
steps:
- uses: uraimo/[email protected]
with:
arch: armv6
distro: buster
run: echo "FOO=42" >> $GITHUB_ENV
- run: echo $FOO
While the variable is set to point to the correct "kind of " file, that file was apparently not mapped into the container or it already changed because of multiple shell invocations. Its UUID suffix indicates its temporary nature:
/home/runner/work/_actions/uraimo/run-on-arch-action/v2.1.1/src/run-on-arch-commands.sh: line 5: /home/runner/work/_temp/_runner_file_commands/set_env_e40c0415-7014-4b2b-8d23-2417768e307e: No such file or directory Error: The process '/home/runner/work/_actions/uraimo/run-on-arch-action/v2.1.1/src/run-on-arch.sh' failed with exit code 1
Now I wonder whether it is possible to forward $GITHUB_ENV at some later point in the scripts. I did some more tests that show the volatile nature of $GITHUB_ENV. The following steps were executed in order in a single job:
- Regular bash script;
echo "GITHUB_ENV=$GITHUB_ENV"GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_6718de84-a08e-45fa-b855-24040844fc12
- Regular bash script;
echo "GITHUB_ENV=$GITHUB_ENV"GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_95b47c92-f8a9-4636-a993-f8955c580597
- Install script (run-on-arch);
echo "GITHUB_ENV=$GITHUB_ENV"/root/run-on-arch-install.sh: line 5: GITHUB_ENV: unbound variable
- Setup script (run-on-arch);
echo "GITHUB_ENV=$GITHUB_ENV"GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_63cda160-76bb-41c3-b532-04793d73c622
- Run script (run-on-arch);
echo "GITHUB_ENV=$GITHUB_ENV"GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_63cda160-76bb-41c3-b532-04793d73c622
- Regular bash script;
echo "GITHUB_ENV=$GITHUB_ENV"GITHUB_ENV=/home/runner/work/_temp/_runner_file_commands/set_env_ae2c0031-c7ce-4ebb-891e-70f8d703f65c
I am not sure how to proceed from here. I think you would need to rebind $GITHUB_ENV again before running the "setup script" and again before running the "run script".
Hi,
At @marceltaeumel, thank you for the excellent report. At @uraimo, very nice github action, thank you very much.
At all: I fixed it here thank to your list of path.
dockerRunArgs: |
--volume /home/runner/work/_temp:/home/runner/work/_temp
Bye.