-
Notifications
You must be signed in to change notification settings - Fork 865
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added PR opening script (cherry picked from commit 14662d2) * Update open-pullrequest.ps1
- Loading branch information
1 parent
7ffe334
commit b1bc0c6
Showing
1 changed file
with
24 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
param( | ||
[Parameter(Mandatory)] | ||
[string] | ||
$SourceBranch | ||
) | ||
|
||
function Get-PullRequest() { | ||
$prInfo = (gh api -X GET repos/:owner/:repo/pulls -F head=":owner:$SourceBranch" -f state=open -f base=master | ConvertFrom-Json) | ||
return $prInfo.html_url | ||
} | ||
|
||
$openedPR = Get-PullRequest | ||
|
||
if ($openedPR.length -ne 0) { | ||
throw "A PR from $SourceBranch to master already exists." | ||
} | ||
|
||
$buildUrl = "$env:SYSTEM_TEAMFOUNDATIONCOLLECTIONURI$env:SYSTEM_TEAMPROJECT/_build/results?buildId=$env:BUILD_BUILDID&_a=summary" | ||
$body = "This PR was auto-generated with [the localization pipeline build]($buildUrl)." | ||
|
||
gh pr create --head $SourceBranch --title 'Localization update' --body $body | ||
|
||
# Getting a link to the opened PR | ||
$env:PR_LINK = Get-PullRequest |