I am trying to create a Dockerfile based action that adds a program to the $PATH
so that it can be used by later actions. My action runs code like this:
mkdir -p $GITHUB_WORKSPACE/bin
echo "echo Hello, world!" > $GITHUB_WORKSPACE/bin/hello-world
echo "::add-path::$GITHUB_WORKSPACE/bin"
My test workflow uses this like so:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
- name: Add program to path
uses: ./
- name: Use program
run: hello-world
This fails because while the program has been added to $GITHUB_WORKSPACE/bin/hello-world
the value of $GITHUB_WORKSPACE
is different in the action and in the workspace step.
In the action it is /github/workspace/
, while in the workflow it is /home/runner/work/setup-gleam/setup-gleam/
, so the $PATH
addition set by the action is not correct.
How can I add a file to a directory from a dockerfile based GitHub action so that it is on the path for the rest of the workflow? It seems that there is no writable $PATH
directory shared between dockerfile actions and non-dockerfile actions.