Setting the workdir for actions using uses

Have been totally stumped by this one. I’m aware of the working-directory option for steps that use run but there does not seem to be anything comparable when using uses.

I’ve tried a number of approaches:

  • working-directory errors

  • with.workdir is ignored (I can see the docker run statement still has the hardcoded --workdir for the full workspace.

  • run: cd my-subdir does not persist to later steps

As-is, it’s seemingly impossible to use an action like the actions-hub/gcloud action when the working directory is important, such as gcloud app deploy which requires the application to be located in the current directory.

I’ve been using Cloudbuild for a similar process for some time, and they have a dir option available on each step which can scope all the work that happens there. Unless I’m missing something, a similar option might be necessary here (e.g., baked in logic that concatenates a dir on uses with the default workdir being set).

4 Likes

The keyword ‘Working-directory’ only works for the script steps, not for action steps.
An action is reusable/isolated code, therefore there is no working directory for a step that uses an action. You probably have to give the action an argument and pass a path.