1
+ # Copyright (c) Microsoft Corporation. All rights reserved.
2
+ # Licensed under the MIT License.
3
+
4
+ # Generates a release build artifact (nuget) from HEAD of master for auth module.
5
+ name : $(BuildDefinitionName)_$(SourceBranchName)_$(Date:yyyyMMdd)$(Rev:.r)
6
+
7
+ pool :
8
+ vmImage : " windows-latest"
9
+
10
+ variables :
11
+ BRANCH : ' weeklyOpenApiDocsDownload'
12
+
13
+ schedules :
14
+ - cron : " 0 12 * * 5" # Run Every Friday at Midnight UTC Time
15
+ displayName : " Weekly OpenApiDocs Download and PR"
16
+ branches :
17
+ include :
18
+ - gn/generateOpenApiDocs
19
+ - dev
20
+ always : true
21
+
22
+ steps :
23
+ - checkout : self
24
+ persistCredentials : true
25
+ clean : true
26
+ - task : securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
27
+ displayName : ' Run CredScan'
28
+ inputs :
29
+ debugMode : false
30
+
31
+ - task : PowerShell@2
32
+ displayName : " Compute Branch"
33
+ inputs :
34
+ targetType : inline
35
+ script : |
36
+ $branch = "{0}.{1}" -f "weeklyOpenApiDocsDownload", (Get-Date -Format yyyyMMdd)
37
+ Write-Host "##vso[task.setvariable variable=BRANCH;]$branch"
38
+ - task : PowerShell@2
39
+ displayName : " Configure User"
40
+ inputs :
41
+ targetType : ' inline'
42
+ script : |
43
+ git config --global user.email "[email protected] "
44
+ git config --global user.name "Azure Devops"
45
+
46
+ - task : PowerShell@2
47
+ displayName : " Show Directory"
48
+ inputs :
49
+ targetType : ' inline'
50
+ script : |
51
+ Write-Host $(System.DefaultWorkingDirectory)
52
+ ls $(System.DefaultWorkingDirectory)
53
+ ls $(System.DefaultWorkingDirectory)/tools
54
+
55
+ - task : PowerShell@2
56
+ displayName : Download v1.0 OpenApiDocs
57
+ inputs :
58
+ filePath : ' $(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1'
59
+ pwsh : true
60
+
61
+ - task : PowerShell@2
62
+ displayName : Download beta OpenApiDocs
63
+ inputs :
64
+ filePath : ' $(System.DefaultWorkingDirectory)/tools/UpdateOpenApi.ps1'
65
+ arguments : ' -BetaGraphVersion'
66
+ pwsh : true
67
+
68
+ - task : Bash@3
69
+ displayName : " Create PR $(BRANCH)"
70
+ inputs :
71
+ targetType : ' inline'
72
+ script : |
73
+ git status
74
+ git checkout dev
75
+ git branch $(BRANCH)
76
+ git checkout $(BRANCH)
77
+ git status
78
+
79
+ - task : Bash@3
80
+ displayName : " Commit Downloaded Files"
81
+ env :
82
+ GITHUB_TOKEN : $(GITHUB_TOKEN)
83
+ inputs :
84
+ targetType : ' inline'
85
+ script : |
86
+ git status
87
+ git add .
88
+ git commit -m 'Weekly OpenApiDocs Download'
89
+ git status
90
+ git push --set-upstream origin $(BRANCH)
91
+ git status
92
+
93
+ - task : Bash@3
94
+ displayName : " Create Pull Request"
95
+ env :
96
+ GITHUB_TOKEN : $(GITHUB_TOKEN)
97
+ MESSAGE_TITLE : Weekly OpenApiDocs Download
98
+ MESSAGE_BODY : " This pull request was automatically created by Azure Devops, \n\n Contains Weekly OpenApiDocs Download files for v1.0 and beta"
99
+ REVIEWERS : peombwa,ddyett
100
+ ASSIGNEDTO : finsharp
101
+ LABELS : generated
102
+ BASE : dev
103
+ BRANCH : $(BRANCH)
104
+ inputs :
105
+ targetType : ' inline'
106
+ script : |
107
+ curl -fsSL https://github.com/github/hub/raw/master/script/get | bash -s 2.14.1
108
+ bin/hub pull-request -b "$BASE" -h "$BRANCH" -m "$MESSAGE_TITLE" -m "$MESSAGE_BODY" -r "$REVIEWERS" -a "$ASSIGNEDTO" -l "$LABELS"
109
+
110
+ # References
111
+ # [0] https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables
112
+ # [1] https://hub.github.com/hub-pull-request.1.html
113
+ # https://help.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token
0 commit comments