-
Notifications
You must be signed in to change notification settings - Fork 3.3k
Expand file tree
/
Copy pathcreate-pull-request.yml
More file actions
72 lines (68 loc) · 2.83 KB
/
create-pull-request.yml
File metadata and controls
72 lines (68 loc) · 2.83 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# Expects AuthToken to be a valid GitHub token.
# Defaults to azuresdk-github-pat for backwards compatibility.
# New callers should pass AuthToken: '' to auto-login via login-to-github.yml.
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
AuthToken: $(azuresdk-github-pat)
# PushAuthToken: for cross-org pushes (pushing to PROwner's fork in a different org).
# Defaults to AuthToken when not specified.
PushAuthToken: ''
steps:
- ${{ if eq(parameters.AuthToken, '') }}:
- template: /eng/common/pipelines/templates/steps/login-to-github.yml
parameters:
TokenOwners:
- ${{ parameters.RepoOwner }}
ScriptDirectory: ${{ parameters.ScriptDirectory }}
- 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 }}
AuthToken: ${{ coalesce(parameters.PushAuthToken, parameters.AuthToken, '$(GH_TOKEN)') }}
- 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 "${{ coalesce(parameters.AuthToken, '$(GH_TOKEN)') }}"
-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 }}