main, but two legacy services still use develop. Instead of keeping a copy of the pull request workflow per repository, define one base_branch context parameter, set a repository value where it differs, and reference it from the workflow. This guide takes about ten minutes.
Before you start
You need a project with at least two connected repositories and a workflow that runs an agent against a repository. Defining a workspace parameter requires a role that can create context parameters; ask a workspace admin if the New Parameter button is missing.Define the parameter
Open Context Parameters in the workspace navigation and select New Parameter. Enter
base_branch as the Key, leave Level at Workspace (visible to every project), and set the Default value to main. Save.The default is what every run uses unless a more specific value applies.Set a value on the legacy repository
Open the legacy repository’s page and find its Context Parameters panel. Select Add override, pick
base_branch, enter develop, and save. The value applies immediately to the next run on that repository.You can do the same from the parameter’s own page: open base_branch, select Add override in the Overrides section, and choose the repository under Where it applies.Reference the parameter in the workflow
Open the workflow in Workflow Builder, select the Agent Run step, and edit Instructions. Type Publish the workflow. Publishing checks that every referenced key exists.
{{params. and pick base_branch from the completion list. For example:Preview the value per repository
Open the Playground, select the workflow, then select the legacy repository. The Context parameters panel lists
params.base_branch with the value develop and the source Repository: <name>. Switch to any other repository and the panel shows main from workspace default.If the panel says no value: the run will fail at preparation, the key has no default and no value on this path. If it says not defined: publishing will be blocked, check the spelling.Run once and confirm
Run the workflow from the Playground against the legacy repository. When the run appears under Logs, open View Details and select Context in the run header. The Run Context panel shows
"base_branch": "develop" under params. That snapshot is what every step in the run used.What you built
One published workflow serves every repository. Adding a third legacy repository is one value on that repository’s page, with no workflow edit and no publish. Changing the convention for everyone is one edit to the default.What to try next
- An orchestration value. Two orchestrations run this workflow with different branch-name suffixes. Add a
branch_suffixparameter, reference it in the instruction, and set a value on each orchestration in its properties panel. The orchestration value wins over the workflow’s own value. - An agent value. Set
review_tonetothoroughon a security reviewer agent andconciseon everyone else. Each agent’s steps resolve its own value in the same run; the Run Context panel shows the difference underagentParamOverrides. - A Run Script step. Read the same value from a script as
$OC_PARAM_BASE_BRANCH, or map it into Environment Variables. See Run Script.
Related
- Context Parameters: every control, the resolution order, and troubleshooting.
- Reuse Across Projects: when a parameter is the right tool and when the Workspace Library is.