Skip to content

Commit cbf9302

Browse files
authored
Merge pull request #2011 from microsoftgraph/v2/examples-update
Examples Update [V2]
2 parents a01313b + 4201404 commit cbf9302

File tree

3 files changed

+560
-0
lines changed

3 files changed

+560
-0
lines changed
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.
2+
3+
trigger: none # disable triggers based on commits.
4+
pr: none # disable as a PR gate.
5+
name: 'PowerShellExamplesUpdateV2 Check'
6+
schedules:
7+
- cron: "0 3 * * FRI" # every Friday at 3AM UTC (off hours for Redmond, Nairobi and Montréal)
8+
displayName: 'PowerShellExamplesUpdateV2'
9+
branches:
10+
include:
11+
- features/2.0
12+
always: true
13+
parameters:
14+
- name: PipelineTimeout
15+
displayName: PipelineTimeout
16+
type: number
17+
default: 1200
18+
- name: BuildAgent
19+
displayName: Build Agent
20+
default: 1es-windows-ps-compute
21+
22+
resources:
23+
repositories:
24+
- repository: msgraph-sdk-powershell
25+
type: github
26+
endpoint: microsoftgraph
27+
name: microsoftgraph/msgraph-sdk-powershell
28+
ref: features/2.0
29+
30+
jobs:
31+
- job: PowerShellExamplesUpdateV2
32+
pool:
33+
name: ${{ parameters.BuildAgent }}
34+
timeoutInMinutes: ${{ parameters.PipelineTimeout }}
35+
steps:
36+
37+
- task: PowerShell@2
38+
name: "ComputeBranch"
39+
displayName: "Compute weekly examples update branch name"
40+
inputs:
41+
targetType: inline
42+
script: |
43+
$branch = "{0}/{1}" -f "WeeklyExamplesUpdate", (Get-Date -Format yyyyMMddHHmm)
44+
Write-Host "Compute branch: $branch"
45+
Write-Host "##vso[task.setvariable variable=WeeklyExamplesBranch;isOutput=true]$branch"
46+
47+
- task: Bash@3
48+
displayName: "Create weekly examples branch"
49+
inputs:
50+
targetType: inline
51+
script: |
52+
git status
53+
git branch $(ComputeBranch.WeeklyExamplesBranch)
54+
git checkout $(ComputeBranch.WeeklyExamplesBranch)
55+
git status
56+
57+
- task: PowerShell@2
58+
displayName: 'Update Examples From API reference - V2'
59+
continueOnError: false
60+
inputs:
61+
targetType: 'filePath'
62+
pwsh: true
63+
filePath: tools\ExamplesGenerator.ps1
64+
65+
- task: PublishBuildArtifacts@1
66+
displayName: 'Publish Examples to be reviewed as artifact'
67+
inputs:
68+
PathtoPublish: 'examplesreport'
69+
ArtifactName: 'ExamplesToBeReviewed'
70+
publishLocation: 'Container'
71+
# StoreAsTar: true
72+
73+
- task: PowerShell@2
74+
displayName: Pushing to github
75+
env:
76+
GITHUB_TOKEN: $(GITHUB_TOKEN)
77+
inputs:
78+
targetType: inline
79+
pwsh: true
80+
script: |
81+
git config --global user.email "[email protected]"
82+
git config --global user.name "Microsoft Graph DevX Tooling"
83+
git status
84+
git add .
85+
git commit -m "Updating examples"
86+
git push --set-upstream https://$(GITHUB_TOKEN)@github.com/microsoftgraph/msgraph-sdk-powershell.git $(ComputeBranch.WeeklyExamplesBranch)
87+
git status
88+
89+
- template: ./common-templates/create-pr.yml
90+
parameters:
91+
BaseBranch: "features/2.0"
92+
TargetBranch: $(ComputeBranch.WeeklyExamplesBranch)
93+
Title: "[v2] Examples Update"
94+
Body: "This pull request was automatically created by Azure Pipelines. **Important** Check for unexpected deletions or changes in this PR."

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,3 +362,6 @@ MigrationBackup/
362362
localenv.json
363363
*Microsoft.Graph.Authentication-TestResults.xml
364364
coverage.xml
365+
366+
#Wrong Examples report Folder
367+
examplesreport/

0 commit comments

Comments
 (0)