Is it possible to change $GITHUB_WORKSPACE?

I am trying to migrate a project off of circleci and onto github Actions. A lot of the project’s CI scripts assumes a certain file structure for the container and we’re running into some issues with actions/checkout as we cannot clone to a location that isn’t underneath $GITHUB_WORKSPACE.

Is there a way to change the value of $GITHUB_WORKSPACE or the context github.workspace?


From the look of it, the actions/checkout@v2 would likely be able to do what you want with the following check removed:

So one option would be to create a fork of the action and use that. That would incur a maintenance burden you’d probably prefer to avoid though. There are a few alternatives though:

  1. symlink the repository from $GITHUB_WORKSPACE to wherever your scripts expect it to exist.
  2. the same as above, but copy the repo instead.
  3. open an issue on the actions/checkout action asking for the restriction to be relaxed (or alternatively submit a PR).

I would not recommend doing that as it will likely break other actions that rely on GITHUB_WORKSPACE.