From 90b4ba7acd6b2cc3eb00f5e0e04e44d236f87670 Mon Sep 17 00:00:00 2001 From: Egor Bryzgalov Date: Thu, 4 Mar 2021 09:53:37 +0300 Subject: [PATCH 1/2] Added PR opening script (cherry picked from commit 14662d23b15c1258ee604dfdeddbb6517f704551) --- open-pullrequest.ps1 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 open-pullrequest.ps1 diff --git a/open-pullrequest.ps1 b/open-pullrequest.ps1 new file mode 100644 index 0000000000..2b824f145b --- /dev/null +++ b/open-pullrequest.ps1 @@ -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 From 359810168fcc0bcfe0a1557de1998c366bb23e55 Mon Sep 17 00:00:00 2001 From: Egor Bryzgalov Date: Wed, 10 Mar 2021 14:45:32 +0300 Subject: [PATCH 2/2] Update open-pullrequest.ps1 --- open-pullrequest.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/open-pullrequest.ps1 b/open-pullrequest.ps1 index 2b824f145b..25afaa84db 100644 --- a/open-pullrequest.ps1 +++ b/open-pullrequest.ps1 @@ -9,7 +9,7 @@ function Get-PullRequest() { return $prInfo.html_url } -$openedPR=Get-PullRequest +$openedPR = Get-PullRequest if ($openedPR.length -ne 0) { throw "A PR from $SourceBranch to master already exists."