I use Azure DevOps as a for CI-CD for a Salesforce project to create a scratch org for feature development. How to trigger pipeline when a branch is created in GitHub?
How to pass a part of the new branch name a variable to the pipeline? Ex: Branch Name - "Sample-GitHub-Branch", Variable to be passed in the pipeline - "Sample".
On the base branch (i.e.
main), set the CI trigger of the pipeline like as below.Then, whenever you create a new branch (i.e.
Sample-GitHub-Branch) based on themain, the pipeline will be triggered for the new branch.In the triggered pipeline, you can use the predefined variable
Build.SourceBranchNameto get the branch name (Sample-GitHub-Branch). Then extract the specified sub-string from the value of it.