azure-sdk-for-cpp/eng/common/pipelines/templates/steps/create-pull-request.yml
Azure SDK Bot 60e28cbd23
Add branch merging support to our mirror pipeline (#4734)
This adds the ability to do a branch merge as part of our mirroring
pipeline. The merge will allow configuration of which files to
move from source to target so it can be scoped to part of the branch.
Instead of a standard push it will create a PR with the merge so it
can be manually reviewed.

Co-authored-by: Wes Haggard <Wes.Haggard@microsoft.com>
2023-06-23 11:41:49 -07:00

60 lines
2.2 KiB
YAML

# Expects azuresdk-github-pat is set to the PAT for azure-sdk
# Expects the buildtools to be cloned
parameters:
BaseBranchName: $(Build.SourceBranch)
PRBranchName: not-specified
PROwner: azure-sdk
CommitMsg: not-specified
RepoOwner: Azure
RepoName: $(Build.Repository.Name)
PushArgs:
WorkingDirectory: $(System.DefaultWorkingDirectory)
PRTitle: not-specified
PRBody: ''
ScriptDirectory: eng/common/scripts
GHReviewers: ''
GHTeamReviewers: ''
GHAssignees: ''
# Multiple labels seperated by comma, e.g. "bug, APIView"
PRLabels: ''
SkipCheckingForChanges: false
CloseAfterOpenForTesting: false
OpenAsDraft: false
steps:
- template: /eng/common/pipelines/templates/steps/git-push-changes.yml
parameters:
BaseRepoBranch: ${{ parameters.PRBranchName }}
BaseRepoOwner: ${{ parameters.PROwner }}
CommitMsg: ${{ parameters.CommitMsg }}
TargetRepoOwner: ${{ parameters.RepoOwner }}
TargetRepoName: ${{ parameters.RepoName }}
PushArgs: ${{ parameters.PushArgs }}
WorkingDirectory: ${{ parameters.WorkingDirectory }}
ScriptDirectory: ${{ parameters.ScriptDirectory }}
SkipCheckingForChanges: ${{ parameters.SkipCheckingForChanges }}
- task: PowerShell@2
displayName: Create pull request
condition: and(succeeded(), eq(variables['HasChanges'], 'true'))
inputs:
pwsh: true
workingDirectory: ${{ parameters.WorkingDirectory }}
filePath: ${{ parameters.ScriptDirectory }}/Submit-PullRequest.ps1
arguments: >
-RepoOwner "${{ parameters.RepoOwner }}"
-RepoName "$(RepoNameWithoutOwner)"
-BaseBranch "${{ parameters.BaseBranchName }}"
-PROwner "${{ parameters.PROwner }}"
-PRBranch "${{ parameters.PRBranchName }}"
-AuthToken "$(azuresdk-github-pat)"
-PRTitle "${{ parameters.PRTitle }}"
-PRBody "${{ coalesce(parameters.PRBody, parameters.CommitMsg, parameters.PRTitle) }}"
-PRLabels "${{ parameters.PRLabels }}"
-UserReviewers "${{ parameters.GHReviewers }}"
-TeamReviewers "${{ parameters.GHTeamReviewers }}"
-Assignees "${{ parameters.GHAssignees }}"
-CloseAfterOpenForTesting $${{ coalesce(parameters.CloseAfterOpenForTesting, 'false') }}
-OpenAsDraft $${{ parameters.OpenAsDraft }}