Forum Discussion
Variables in Resources:Repositories:Repository:Ref
Hi blashmet ,
Thanks for your great question. I see in your example that in the Manual case your reference SourceBranchName and in the PR case your reference targetBranch without the Name suffix in the variable name. In the documentation on system variables it describes how the `System.PullRequest.targetBranchName` variable contains the branch name and the `System.PullRequest.TargetBranch` variable contains the full ref. This behaviour is the same for the `Build.SourceBranch` and `Build.SourceBranchName` variables. Where again the first contains the full ref and the other just the branch name.
So in your case I would try to use `System.PullRequest.targetBranchName` instead of `System.PullRequest.targetBranch`. Hope that helps in solving your issue.
See Predefined variables - Azure Pipelines | Microsoft Learn for details on the variations
- blashmetOct 30, 2023Copper ContributorThis is a great catch. I did however try all combinations of:
SourceBranch / SourceBranchName
TargetBranch/ TargetBranchName
Apologies if the example misled, it was the last combination that I had tried.
Were you able to test and create the desired behavior? (i.e., parameterize the ref for both Manual builds and PR builds?) If so I would love to see the actual code, but I will double check on my end to ensure that I used all combinations of SourceBranch/Name TargetBranch/Name.
Thanks for the help 🙂 - blashmetOct 30, 2023Copper ContributorThis was solved, see here: https://stackoverflow.com/questions/77381443/how-can-we-specify-the-branch-for-manual-pr-builds-in-resourcesrepositoriesr