projects:branch-tracking:set
Use projects:branch-tracking:set to create or update a branch tracking rule for your project.
About projects:branch-tracking:set
This section describes how branch tracking rule creations and updates are performed.
When you run this command, you specify a branch (such as production, preview, or any custom branch name) and whether tracking should be --enabled or --no-enabled. If the specified custom branch rule already exists, it is updated; otherwise, a new rule is created. The command outputs { "success": true } upon successful completion.
Using projects:branch-tracking:set
This section provides a repeatable workflow for creating or updating a branch tracking rule.
Concept and Goal
To control whether push events on a specific branch should automatically trigger deployments, use this procedure to configure branch tracking rules.
What you need
- You installed the CLI package.
- You set
MONOLAYER_BASE_URLor plan to pass--base-url. - You set
MONOLAYER_AUTH_TOKEN(must be a deployment token starting withdeploy_token_) or plan to pass--auth-token.
Numbered Steps
- Run the command with explicit flags to set a branch tracking rule.
npx mnlyr projects:branch-tracking:set \
--base-url https://control-plane-domain \
--auth-token deploy_token_xxx \
--project-id proj-1 \
--branch feature-test \
--enabled- Run the command using environment variables when you prefer session defaults.
MONOLAYER_BASE_URL="https://control-plane-domain" \
MONOLAYER_AUTH_TOKEN="deploy_token_xxx" \
npx mnlyr projects:branch-tracking:set --project-id proj-1 --branch feature-test --no-enabledExpected Result
The command returns { "success": true } on successful completion.
projects:branch-tracking:set Reference
This section lists command syntax, options, and sample output.
Command syntax
npx mnlyr projects:branch-tracking:set [options]Options
| Option | Description |
|---|---|
--base-url <url> | Sets the control plane base URL. You can also set MONOLAYER_BASE_URL. |
--auth-token <token> | Sets the project deployment auth token. You can also set MONOLAYER_AUTH_TOKEN. |
--project-id <id> | The identifier of your project. This option is required. |
--branch <branch> | The branch name or scope (production, preview, or a custom branch name). This is required. |
--enabled / --no-enabled | Enable or disable tracking for the specified branch. This is required. |
-h, --help | Shows command help. |
Output
{
"success": true
}Troubleshooting
This section lists common command errors.
- Missing base URL:
Missing base URL. Pass --base-url explicitly or set MONOLAYER_BASE_URL. - Missing authentication token:
Missing auth token. Pass --auth-token explicitly or set MONOLAYER_AUTH_TOKEN. - Invalid token format:
auth-token must start with "deploy_token_"