Changes the Working Directory for all subsequent Steps to a specified path.
Description
This Step changes the base Working Directory for every subsequent Step in the Workflow to the specified path.
Useful, for example, for projects like monorepos where the Bitrise workflow primarily takes place in an iOS or android subdirectory.
- Set the Directory path to the path you want subsequent Steps to use as their Working Directory.
- Use the Create path if doesn't exist? input to control whether the path is created when it is missing.
If the Step fails with a "does not exist" error, either set Create path if doesn't exist? to true, or make sure an earlier Step creates the directory.
The provided path is resolved to an absolute path before it is applied, so relative paths are resolved against the current Working Directory.
Add this step directly to your workflow in the Bitrise Workflow Editor.
You can also run this step directly with Bitrise CLI.
Inputs
| Key | Description | Flags | Default |
|---|---|---|---|
path |
The path to set as the base Working Directory for every subsequent Step. It is resolved to an absolute path before being applied. | required | |
is_create_path |
When set to true, the Step creates the directory (including parent directories) if it does not exist yet. When set to false, the Step fails if the directory is missing. |
required | true |
use_sudo |
When enabled, the Step retries creating the directory with sudo if it hits a permission error. This is required on stacks where the Step runs as the non-root user and the directory must be created inside a root-owned parent directory. Disable this if sudo is unavailable in your environment or you want permission errors to fail the Step directly. |
required | true |
Outputs
| Environment Variable | Description |
|---|---|
BITRISE_SOURCE_DIR |
The expanded absolute path that the Step set as the base Working Directory. Bitrise uses BITRISE_SOURCE_DIR as the Working Directory for every subsequent Step, so changing it is how this Step takes effect. |
PWD |
The expanded absolute path, exported as PWD so that subsequent Steps and scripts see the new Working Directory. |
We welcome pull requests and issues against this repository.
For pull requests, work on your changes in a forked repository and use the Bitrise CLI to run step tests locally.
Learn more about developing steps: