Skip to content

Remove create PR GitHub actions #1866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
# Licensed under the MIT License.

parameters:
- name: BaseBranch
type: string
- name: DOCSBRANCH
type: string
default: "DocsGeneration"
Expand Down Expand Up @@ -54,4 +56,12 @@ steps:
script: |
git status
git push --set-upstream "https://$(GITHUB_TOKEN)@github.com/microsoftgraph/msgraph-sdk-powershell.git" $(ComputeBranch.DocsBranch)
git status
git status

- pwsh: '$(System.DefaultWorkingDirectory)/scripts/create-pull-request.ps1'
displayName: 'Create Pull Request for generated build'
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
BaseBranch: ${{ parameters.BaseBranch }}
Title: '[v1] Weekly Help Docs Generation'
Body: 'This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR.'
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,14 @@ parameters:
- name: GenerateHelpDocs
type: boolean
default: false
- name: GeneratePullRequest
type: boolean
default: false
- name: DOCSBRANCH
type: string
default: "DocsGeneration"
- name: BaseBranch
type: string

jobs:
- job: GenerateServiceModules
Expand All @@ -44,7 +49,9 @@ jobs:
PublishToFeed: ${{ parameters.PublishToFeed }}
GenerateCommandMetadata: ${{ parameters.GenerateCommandMetadata }}
GenerateHelpDocs: ${{ parameters.GenerateHelpDocs }}
GeneratePullRequest: ${{ parameters.GeneratePullRequest }}
DocsBranch: ${{ parameters.DocsBranch }}
BaseBranch: ${{ parameters.BaseBranch }}
steps:
- template: ../common-templates/checkout.yml
parameters:
Expand Down Expand Up @@ -155,6 +162,15 @@ jobs:
- ${{ if eq(parameters.GenerateCommandMetadata, true) }}:
- template: ./generate-command-metadata-template.yml

- ${{ if eq(parameters.GeneratePullRequest, true) }}:
- pwsh: '$(System.DefaultWorkingDirectory)/scripts/create-pull-request.ps1'
displayName: 'Create Pull Request for generated build'
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
BaseBranch: $(BaseBranch)
Title: '[v1] Weekly OpenApiDocs Refresh'
Body: 'This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR.'

- task: SFP.build-tasks.custom-build-task-1.EsrpCodeSigning@1
displayName: ESRP DLL strong name (Service Modules)
condition: and(succeeded(), eq('${{ parameters.EnableSigning }}', true))
Expand Down Expand Up @@ -290,8 +306,9 @@ jobs:
- ${{ if eq(parameters.GenerateHelpDocs, true) }}:
- template: ./generate-helpdocs-template.yml
parameters:
DOCSBRANCH: $(DocsBranch)
ModulesToGenerate: $(ModulesToGenerate)
BaseBranch: $(BaseBranch)
DOCSBRANCH: $(DocsBranch)
ModulesToGenerate: $(ModulesToGenerate)

- task: PowerShell@2
displayName: Find Duplicate Commands
Expand Down
10 changes: 9 additions & 1 deletion .azure-pipelines/weekly-examples-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,12 @@ jobs:
git add .
git commit -m "Updating examples "+$date
git push --set-upstream "https://$(GITHUB_TOKEN)@github.com/microsoftgraph/msgraph-sdk-powershell.git" $proposedBranch
git status
git status

- pwsh: '$(System.DefaultWorkingDirectory)/scripts/create-pull-request.ps1'
displayName: 'Create examples update'
env:
GITHUB_TOKEN: $(GITHUB_TOKEN)
BaseBranch: 'dev'
Title: '[v1] Examples Update'
Body: 'This pull request was automatically created by Azure Pipelines. Contains examples update.'
2 changes: 2 additions & 0 deletions .azure-pipelines/weekly-generation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ stages:
AuthModulePath: "src/Authentication/Authentication"
ServiceModulePath: "src/"
ModulePrefix: "Microsoft.Graph"
BaseBranch: $(BaseBranch)
EnableSigning: false
PublishToFeed: false
GenerateCommandMetadata: true
GenerateHelpDocs: true
GeneratePullRequest: true
54 changes: 0 additions & 54 deletions .github/workflows/create-helpdocs-pr-workflow.yml

This file was deleted.

54 changes: 0 additions & 54 deletions .github/workflows/create-openapidocs-pr-workflow.yml

This file was deleted.

53 changes: 0 additions & 53 deletions .github/workflows/create-preview-openapidocs-pr-workflow.yml

This file was deleted.

47 changes: 0 additions & 47 deletions .github/workflows/update_examples_pr_workflow.yml

This file was deleted.

17 changes: 17 additions & 0 deletions scripts/create-pull-request.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$title = $env:Title
$body = $env:Body
$baseBranchParameter = ""

if (![string]::IsNullOrEmpty($env:BaseBranch))
{
$baseBranchParameter = "-B $env:BaseBranch" # optionally pass the base branch if provided as the PR will target the default branch otherwise
}

# Code owners will be added automatically as reviewers.
Invoke-Expression "gh auth login" # login to GitHub
Invoke-Expression "gh pr create -t ""$title"" -b ""$body"" $baseBranchParameter | Write-Host"

Write-Host "Pull Request Created successfully." -ForegroundColor Green