Sync eng/common directory with azure-sdk-tools for PR 1489 (#1928)

* Add draft to Submit-PullRequest.ps1

* Add -Draft to create-pull-request.yml

* Add documentation

* Rename: Draft[Pr] -> OpenAsDraft

* Update docs

Co-authored-by: Daniel Jurek <djurek@microsoft.com>
This commit is contained in:
Azure SDK Bot 2021-03-18 14:50:46 -07:00 committed by GitHub
parent e464f8b01e
commit d577d25041
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 28 additions and 4 deletions

View File

@ -20,6 +20,7 @@ parameters:
PRLabels: ''
SkipCheckingForChanges: false
CloseAfterOpenForTesting: false
OpenAsDraft: false
steps:
@ -87,3 +88,4 @@ steps:
-TeamReviewers "${{ parameters.GHTeamReviewersVariable }}"
-Assignees "${{ parameters.GHAssignessVariable }}"
-CloseAfterOpenForTesting $${{ coalesce(parameters.CloseAfterOpenForTesting, 'false') }}
-OpenAsDraft $${{ parameters.OpenAsDraft }}

View File

@ -21,6 +21,19 @@ The title of the pull request.
The body message for the pull request.
.PARAMETER PRLabels
The labels added to the PRs. Multple labels seperated by comma, e.g "bug, service"
.PARAMETER UserReviewers
User reviewers to request after opening the PR. Users should be a comma-
separated list with no preceeding `@` symbol (e.g. "user1,usertwo,user3")
.PARAMETER TeamReviewers
List of github teams to add as reviewers
.PARAMETER Assignees
Users to assign to the PR after opening. Users should be a comma-separated list
with no preceeding `@` symbol (e.g. "user1,usertwo,user3")
.PARAMETER CloseAfterOpenForTesting
Close the PR after opening to save on CI resources and prevent alerts to code
owners, assignees, requested reviewers, or others.
.PARAMETER OpenAsDraft
Opens the PR as a draft
#>
[CmdletBinding(SupportsShouldProcess = $true)]
param(
@ -56,7 +69,9 @@ param(
[string]$Assignees,
[boolean]$CloseAfterOpenForTesting=$false
[boolean]$CloseAfterOpenForTesting=$false,
[boolean]$OpenAsDraft=$false
)
. (Join-Path $PSScriptRoot common.ps1)
@ -79,9 +94,16 @@ if ($resp.Count -gt 0) {
}
else {
try {
$resp = New-GitHubPullRequest -RepoOwner $RepoOwner -RepoName $RepoName -Title $PRTitle `
-Head "${PROwner}:${PRBranch}" -Base $BaseBranch -Body $PRBody -Maintainer_Can_Modify $true `
-AuthToken $AuthToken
$resp = New-GitHubPullRequest `
-RepoOwner $RepoOwner `
-RepoName $RepoName `
-Title $PRTitle `
-Head "${PROwner}:${PRBranch}" `
-Base $BaseBranch `
-Body $PRBody `
-Maintainer_Can_Modify $true `
-Draft:$OpenAsDraft `
-AuthToken $AuthToken
$resp | Write-Verbose
LogDebug "Pull request created https://github.com/$RepoOwner/$RepoName/pull/$($resp.number)"