Skip to content

Commit 6a9c6af

Browse files
committed
Move create-pr to pipeline task
1 parent a9add54 commit 6a9c6af

File tree

6 files changed

+55
-68
lines changed

6 files changed

+55
-68
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Copyright (c) Microsoft Corporation. All rights reserved.
2+
# Licensed under the MIT License.
3+
4+
parameters:
5+
- name: BaseBranch
6+
type: string
7+
default: dev
8+
- name: TargetBranch
9+
type: string
10+
default: ""
11+
- name: Title
12+
type: string
13+
default: ""
14+
- name: Body
15+
type: string
16+
default: ""
17+
18+
steps:
19+
- task: PowerShell@2
20+
displayName: Create Pull Request for generated build
21+
env:
22+
GITHUB_TOKEN: $(GITHUB_TOKEN)
23+
inputs:
24+
pwsh: true
25+
targetType: inline
26+
script: |
27+
$BaseBranchName = "${{ parameters.BaseBranch }}"
28+
$Head = "microsoftgraph:${{ parameters.TargetBranch }}"
29+
$Title = "${{ parameters.Title }}"
30+
$Body = "${{ parameters.Body }}"
31+
32+
git status
33+
gh auth login
34+
git push "https://$(GITHUB_TOKEN)@github.com/microsoftgraph/msgraph-sdk-powershell.git"
35+
gh pr create -t $Title -b $Body -B $BaseBranchName -H $Head

.azure-pipelines/generation-templates/generate-command-metadata-template.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ steps:
1818
inputs:
1919
targetType: inline
2020
script: |
21-
git status
21+
git branch
2222
git add "$(System.DefaultWorkingDirectory)/src/Authentication/Authentication/custom/common/MgCommandMetadata.json"
2323
git commit -m 'Add generated MgCommandMetadata.json. [run ci]'
2424
git push "https://$(GITHUB_TOKEN)@github.com/microsoftgraph/msgraph-sdk-powershell.git"
25-
git status
25+
git status

.azure-pipelines/generation-templates/generate-helpdocs-template.yml

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -59,15 +59,9 @@ steps:
5959
git push --set-upstream "https://$(GITHUB_TOKEN)@github.com/microsoftgraph/msgraph-sdk-powershell.git" $(ComputeBranch.DocsBranch)
6060
git status
6161
62-
- task: PowerShell@2
63-
displayName: Create Pull Request for Weekly Help Docs Generation
64-
env:
65-
GITHUB_TOKEN: $(GITHUB_TOKEN)
66-
inputs:
67-
pwsh: true
68-
targetType: inline
69-
script: |
70-
$Title = "[v1] Weekly Help Docs Generation"
71-
$Body = "This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR."
72-
$BaseBranch = "dev"
73-
. $(System.DefaultWorkingDirectory)/scripts/create-pull-request.ps1 -Title $Title -Body $Body -BaseBranchName $BaseBranch
62+
- template: ../common-templates/create-pr.yml
63+
parameters:
64+
BaseBranch: "dev"
65+
TargetBranch: $(ComputeBranch.DocsBranch)
66+
Title: "[v1] Weekly Help Docs Generation"
67+
Body: "This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR."

.azure-pipelines/generation-templates/generate-service-modules.yml

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -164,19 +164,12 @@ jobs:
164164
- template: ./generate-command-metadata-template.yml
165165

166166
- ${{ if eq(parameters.GeneratePullRequest, true) }}:
167-
- task: PowerShell@2
168-
displayName: Create Pull Request for generated build
169-
env:
170-
GITHUB_TOKEN: $(GITHUB_TOKEN)
171-
inputs:
172-
pwsh: true
173-
targetType: inline
174-
script: |
175-
git status
176-
$Title = "[v1] Weekly OpenApiDocs Refresh"
177-
$Body = "This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR."
178-
$BaseBranch = "dev"
179-
. $(System.DefaultWorkingDirectory)/scripts/create-pull-request.ps1 -Title $Title -Body $Body -BaseBranchName $BaseBranch
167+
- template: ../common-templates/create-pr.yml
168+
parameters:
169+
BaseBranch: "dev"
170+
TargetBranch: $(Branch)
171+
Title: "[v1] Weekly OpenApiDocs Refresh"
172+
Body: "This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR."
180173

181174
- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
182175
displayName: ESRP DLL strong name (Service Modules)

.azure-pipelines/weekly-examples-update.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,9 @@ jobs:
7777
git push --set-upstream origin $(ComputeBranch.WeeklyExamplesBranch)
7878
git status
7979
80-
- task: PowerShell@2
81-
displayName: Create examples update
82-
env:
83-
GITHUB_TOKEN: $(GITHUB_TOKEN)
84-
inputs:
85-
pwsh: true
86-
targetType: inline
87-
script: |
88-
git status
89-
Start-Sleep 15s
90-
$Title = "[v1] Examples Update"
91-
$Body = "This pull request was automatically created by Azure Pipelines. Contains examples update."
92-
$BaseBranch = "dev"
93-
. $(System.DefaultWorkingDirectory)/scripts/create-pull-request.ps1 -Title $Title -Body $Body -BaseBranchName $BaseBranch
80+
- template: ./common-templates/create-pr.yml
81+
parameters:
82+
BaseBranch: "dev"
83+
TargetBranch: $(ComputeBranch.WeeklyExamplesBranch)
84+
Title: "[v1] Examples Update"
85+
Body: "This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR."

scripts/create-pull-request.ps1

Lines changed: 0 additions & 27 deletions
This file was deleted.

0 commit comments

Comments
 (0)