Skip to content

Commit ba01cbe

Browse files
Merge branch 'public' into patch-2
2 parents 845f842 + 332017d commit ba01cbe

File tree

1,201 files changed

+138479
-18105
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,201 files changed

+138479
-18105
lines changed

.acrolinx-config.edn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ For more information about the exception criteria and exception process, see [Mi
3939
4040
Select the total score link to review all feedback on clarity, consistency, tone, brand, terms, spelling, grammar, readability, and inclusive language. _You should fix all spelling errors regardless of your total score_. Fixing spelling errors helps maintain customer trust in overall content quality.
4141
42-
| Article | Total score<br>(Required: 80) | Words + phrases<br>(Brand, terms) | Correctness<br>(Spelling, grammar) | Clarity<br>(Readability) |
42+
| Article | Total score<br>(Required: 80) | Terminology | Spelling and Grammar | Clarity<br>(Readability) |
4343
|---------|:--------------:|:--------------------:|:------:|:---------:|
4444
"
4545

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: PR has no warnings or errors
2+
3+
permissions:
4+
pull-requests: write
5+
statuses: write
6+
7+
on:
8+
issue_comment:
9+
types: [created]
10+
11+
jobs:
12+
13+
build-status:
14+
uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-BuildValidation.yml@workflows-prod
15+
with:
16+
PayloadJson: ${{ toJSON(github) }}
17+
secrets:
18+
AccessToken: ${{ secrets.GITHUB_TOKEN }}
19+
20+
21+

.github/workflows/M365Endpoints.yml

Lines changed: 162 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,19 @@ name: (Scheduled) M365 Endpoints includes automation
22

33
permissions:
44
contents: write
5+
pull-requests: write
56
actions: read
67

8+
# Reduced the number of run times per day to three and changed to run only Mon-Fri since those are the days we have publishing. No point running on weekends.
9+
# Tried to reflect PDT/PST. There will be a couple weeks during the changeover months where time will be off an hour.
710
on:
8-
# schedule:
9-
# - cron: "0 */6 * * *"
11+
schedule:
12+
### PST ###
13+
- cron: "45 17,22 * 11,12,1,2 1-5" # 09:45 & 14:45 PST = 17:45 & 22:45 UTC, same day (Mon-Fri)
14+
- cron: "45 7 * 11,12,1,2 2-6" # 23:45 PST = 07:45 UTC, next day (Tue-Sat)
15+
### PDT ###
16+
- cron: "45 16,21 * 3-10 1-5" # 09:45 & 14:45 PDT = 16:45 & 21:45 UTC, same day (Mon-Fri)
17+
- cron: "45 6 * 3-10 2-6" # 23:45 PDT = 06:45 UTC, next day (Tue-Sat)
1018

1119
workflow_dispatch:
1220

@@ -57,10 +65,11 @@ jobs:
5765
- name: Process endpoint data
5866
shell: pwsh
5967
env:
60-
AccessToken: ${{ github.token }}
68+
AccessToken: ${{ secrets.MARVEL_REPO_ACCESS_TOKEN }}
6169
TargetOrganization: "MicrosoftDocs"
6270
TargetRepository: "microsoft-365-docs-pr"
6371
TargetPath: "microsoft-365/includes"
72+
EndpointsContentOwner: "kelleyvice-msft"
6473
run: |
6574
6675
# GetServiceInstanceEndpoints
@@ -144,21 +153,22 @@ jobs:
144153
$script:allServiceAreas = @("Exchange", "SharePoint", "Skype", "Common")
145154
146155
# GitHub Setup
147-
### AZURE (for producton) ###
148156
149157
# Create github HTTP authentication header
150158
$script:OfficedocsprToken = $env:AccessToken
151159
$script:GitHubHeaders = @{}
152160
$script:GitHubHeaders.Add("Authorization","token $($OfficedocsprToken)")
153161
$script:GitHubHeaders.Add("User-Agent", "OfficeDocs")
154162
155-
# GitHub user/repo/branch to use (Azure)
156-
$script:GHUser = $env:TargetOrganization # The GitHub user that owns the repository
163+
# GitHub user and repo values to use
164+
$script:Organization = $env:TargetOrganization # The GitHub user that owns the repository
157165
$script:Repository = $env:TargetRepository # The remote repository to upload to
158-
$script:Branch = Get-RepoDefaultBranch -Headers $script:GitHubHeaders -Org $script:GHUser -Repo $script:Repository # The remote branch
166+
$script:TargetBranch = "M365-Endpoints"
167+
$script:DefaultBranch = Get-RepoDefaultBranch -Headers $script:GitHubHeaders -Org $script:Organization -Repo $script:Repository # The remote branch
159168
$script:RepoDir = $env:TargetPath # The target directory in the remote repository
169+
$script:EndpointsContentOwner = $env:EndpointsContentOwner
160170
161-
171+
$script:PrDescription = "@MicrosoftDocs/marveldocs-pubops`n`nThis is an automated pull request to update M365 Endpoints include files in **$RepoDir**. Before merging this PR, confirm the following:`n`n- There are no more than **$($siHash.count)** files in the PR`n- The only files in the pull request end with **$($OutFileSuffix.Trim())**`n- There are no obvious formatting issues with the content`n- The pull request is from **$TargetBranch** to **$DefaultBranch**`n`nIf issues are found with the PR, remove the **Sign off** label and add the **Back to submitter** label, assign the PR to **$EndpointsContentOwner**, and @-mention **$EndpointsContentOwner** with instructions on how to resolve the issue.`n`nAcrolinx issues can be ignored per exception: https://office.visualstudio.com/MAX/_workitems/edit/9352479`n`nIf no issues are found, merge the PR. If you have questions, email marveldocs-admins."
162172
163173
} # end Set-ScriptOptions function
164174
@@ -190,6 +200,7 @@ jobs:
190200
Write-Host "Getting default branch for $Repo. URL: https://api.github.com/repos/$Org/$Repo"
191201
$DefaultBranch = (Invoke-RestMethod -Headers $Headers -Uri https://api.github.com/repos/$Org/$Repo -ErrorAction Stop -ErrorVariable GitHubDefaultBranchError).default_branch
192202
203+
# $DefaultBranch = "dstrome-test"
193204
Write-Host "Default for $Repo is `"$DefaultBranch`""
194205
195206
$script:SetDefaultBranchSuccess = $True
@@ -268,9 +279,30 @@ jobs:
268279
269280
Write-Host "Get file list from GitHub"
270281
271-
# We need the SHA of the existing files on GitHub in order to update (i.e. replace) them.
272-
# To do that we get the repository directory listing.
273-
$repoList = Invoke-RestMethod -Headers $GitHubHeaders -Uri https://api.github.com/repos/$($GHUser)/$($Repository)/contents/$($RepoDir)?ref=$($Branch)
282+
# Try to get $TargetBranch. If it exists, get the file list from $TargetBranch. If not, get it from $DefaultBranch.
283+
Try {
284+
285+
Invoke-RestMethod -uri "https://api.github.com/repos/$Organization/$Repository/git/ref/heads/$TargetBranch" -headers $GitHubHeaders -Method Get | Out-Null
286+
287+
Write-Host "Branch $TargetBranch exists. Getting file list from $TargetBranch."
288+
289+
# We need the SHA of the existing files on GitHub in order to update (i.e. replace) them.
290+
# To do that we get the repository directory listing.
291+
$repoList = Invoke-RestMethod -Headers $GitHubHeaders -Uri https://api.github.com/repos/$Organization/$Repository/contents/$($RepoDir)?ref=$($TargetBranch)
292+
293+
294+
} Catch {
295+
296+
Write-Host "Branch $TargetBranch does not exist. Getting file list from $DefaultBranch."
297+
298+
# We need the SHA of the existing files on GitHub in order to update (i.e. replace) them.
299+
# To do that we get the repository directory listing.
300+
$repoList = Invoke-RestMethod -Headers $GitHubHeaders -Uri https://api.github.com/repos/$Organization/$Repository/contents/$($RepoDir)?ref=$($DefaultBranch)
301+
302+
303+
}
304+
305+
274306
275307
# Create a hash table with the name and SHA of each file in the remote repository
276308
# This will be used when uploading the output files
@@ -400,7 +432,7 @@ jobs:
400432
401433
Write-Host "Create output file for $si"
402434
403-
# Generate the file name, converted to lowercase and replacing spaces with dashes for Azure compatibility
435+
# Generate the file name, converted to lowercase and replacing spaces with dashes for compatibility
404436
$script:siFile = (($siHash.$si + $outFileSuffix) -replace (" ", "-")).ToLower()
405437
Out-File -FilePath ($path + $siFile) -Force # overwrite previous output file if it exists
406438
$fileNotice | Out-File -Append -FilePath ($path + $siFile)
@@ -497,7 +529,7 @@ jobs:
497529
Uploads a file to a GitHub repository using the GitHub API
498530
.DESCRIPTION
499531
The function uses the GitHub variables declared earlier in the script
500-
(GHUser, Repository, RepoDir, Branch, GitHubHeaders) to upload a file
532+
(Organization, Repository, RepoDir, Branch, GitHubHeaders) to upload a file
501533
to a repository.
502534
.PARAMETER path
503535
A path where the directory where theupload file can be found
@@ -515,19 +547,128 @@ jobs:
515547
$Base64Content = [System.Convert]::ToBase64String([IO.File]::ReadAllBytes($path + $file))
516548
517549
# Build the body of the message with the file info.
518-
# Required: message, content, sha, path (NOTE: path is after "contents/" in URI)
519-
# Optional: branch (defaults to master)
520550
$Body = @{
521551
message = "Uploaded file: " + ($file) + " - " + (Get-Date -Format yyyy-MM-dd` HH:mm:ss.ffff)
522552
content = $Base64Content
523553
sha = $sha
524-
branch = $Branch
554+
branch = $TargetBranch
525555
} | ConvertTo-Json
526556
557+
# Check if $TargetBranch exists and, if not, create it from $DefaultBranch
558+
Try {
559+
560+
Invoke-RestMethod -uri "https://api.github.com/repos/$Organization/$Repository/git/ref/heads/$TargetBranch" -headers $GitHubHeaders -Method Get | Out-Null
561+
562+
} Catch {
563+
564+
Write-Host "Branch $TargetBranch does not exist. Creating branch $TargetBranch from $DefaultBranch."
565+
566+
$DefaultBranchData = Invoke-RestMethod -uri "https://api.github.com/repos/$Organization/$Repository/git/ref/heads/$DefaultBranch" -Headers $GitHubHeaders -Method Get
567+
568+
$BranchBody = @{
569+
ref = "refs/heads/$TargetBranch"
570+
sha = $DefaultBranchData.object.sha
571+
} | ConvertTo-Json
572+
573+
Invoke-RestMethod -uri "https://api.github.com/repos/$Organization/$Repository/git/refs" -headers $GitHubHeaders -Method POST -Body $BranchBody
574+
575+
}
576+
577+
Write-Host $Body
578+
Write-Host "https://api.github.com/repos/$Organization/$Repository/contents/$($RepoDir)/$($File)?ref=$TargetBranch"
579+
527580
# Upload the file
528-
Invoke-RestMethod -Headers $GitHubHeaders -Uri https://api.github.com/repos/$($GHUser)/$($Repository)/contents/$($RepoDir)/$($file)?ref=$($Branch) -Method PUT -Body $Body
581+
Invoke-RestMethod -Headers $GitHubHeaders -Uri https://api.github.com/repos/$Organization/$Repository/contents/$($RepoDir)/$($File)?ref=$TargetBranch -Method PUT -Body $Body
529582
} # end Send-ToGitHub function
530583
584+
Function New-PullRequest {
585+
586+
$BranchResponse = $Null
587+
588+
Write-Host "Checking if $TargetBranch exists"
589+
590+
Try {
591+
592+
$BranchResponse = Invoke-RestMethod -uri "https://api.github.com/repos/$Organization/$Repository/git/ref/heads/$TargetBranch" -headers $GitHubHeaders -Method Get -ErrorAction Stop
593+
594+
} Catch {
595+
596+
Write-Host "Branch doesn't exist."
597+
598+
}
599+
600+
If ($BranchResponse) {
601+
602+
Write-Host "Checking if $TargetBranch is ahead of $DefaultBranch"
603+
604+
Try {
605+
606+
$CompareResponse = Invoke-RestMethod -Uri "https://api.github.com/repos/$Organization/$Repository/compare/$DefaultBranch...$TargetBranch" -Method GET -Headers $GitHubHeaders
607+
608+
} Catch {
609+
610+
Throw "Failed to check if $TargetBranch is ahead of $DefaultBranch. Error: $($Error[0])"
611+
612+
}
613+
614+
If ($CompareResponse.ahead_by -gt 0) {
615+
616+
Write-Host "$TargetBranch has changes ahead of $DefaultBranch"
617+
618+
Write-Host "Checking if a pull request exists between $TargetBranch and $DefaultBranch"
619+
620+
Try {
621+
622+
$PrsResponse = Invoke-RestMethod -Uri "https://api.github.com/repos/$Organization/$Repository/pulls?head=$($Organization):$TargetBranch&base=$DefaultBranch&state=open" -Method GET -Headers $GitHubHeaders
623+
624+
} Catch {
625+
626+
Throw "Failed to check if pull request exists between $TargetBranch and $DefaultBranch. Error: $($Error[0])"
627+
628+
}
629+
630+
If (($PrsResponse | Measure-Object).Count -le 0) {
631+
632+
Write-Host "No existing pull request. Creating a new PR from $TargetBranch to $DefaultBranch"
633+
634+
$PrBody = @{
635+
title = "Merge $TargetBranch into $DefaultBranch"
636+
head = $TargetBranch
637+
base = "$DefaultBranch"
638+
body = "$PrDescription"
639+
} | ConvertTo-Json
640+
641+
Try {
642+
643+
$PrResponse = Invoke-RestMethod -Uri "https://api.github.com/repos/$Organization/$Repository/pulls" -Method POST -Headers $GitHubHeaders -Body $PrBody
644+
645+
Write-Host "Created pull request $($PrResponse.html_url)"
646+
647+
$LabelBody = @{
648+
labels = @("Sign off")
649+
} | ConvertTo-Json
650+
651+
Invoke-RestMethod -Uri "https://api.github.com/repos/$Organization/$Repository/issues/$($PrResponse.number)/labels" -Method POST -Headers $GitHubHeaders -Body $LabelBody
652+
653+
} Catch {
654+
655+
Throw "Failed to create pull request. Error: $($Error[0])"
656+
657+
}
658+
659+
660+
} Else {
661+
662+
Write-Host "Pull request exists. "
663+
664+
}
665+
666+
}
667+
668+
}
669+
670+
}
671+
531672
### END FUNCTION BLOCK ###
532673
### BEGIN EXECUTION BLOCK ###
533674

@@ -619,6 +760,9 @@ jobs:
619760

620761
} # end serviceInstances loop
621762

763+
# Create a new pull request. New-PullRequest will only create a new PR if one is needed.
764+
New-PullRequest
765+
622766
} # set default branch check
623767

624768
ls -alr $dataPath
@@ -628,4 +772,4 @@ jobs:
628772
name: Upload run data artifact
629773
with:
630774
name: RunData
631-
path: "${{ github.workspace }}/run-data/endpoints*"
775+
path: "${{ github.workspace }}/run-data/endpoints*"

.github/workflows/Stale.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: (Scheduled) Mark stale pull requests
2+
3+
permissions:
4+
issues: write
5+
pull-requests: write
6+
7+
on:
8+
schedule:
9+
- cron: "0 */6 * * *"
10+
workflow_dispatch:
11+
12+
jobs:
13+
stale:
14+
uses: MicrosoftDocs/microsoft-365-docs/.github/workflows/Shared-Stale.yml@workflows-prod
15+
with:
16+
RunDebug: false
17+
RepoVisibility: ${{ github.repository_visibility }}
18+
secrets:
19+
AccessToken: ${{ secrets.GITHUB_TOKEN }}

.openpublishing.build.ps1

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

.openpublishing.publish.config.json

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,21 +113,22 @@
113113
".openpublishing.redirection.commerce.json",
114114
".openpublishing.redirection.compliance.json",
115115
".openpublishing.redirection.contentunderstanding.json",
116+
".openpublishing.redirection.copilot.json",
117+
".openpublishing.redirection.defender.json",
116118
".openpublishing.redirection.enterprise.json",
117119
".openpublishing.redirection.frontline.json",
118120
".openpublishing.redirection.knowledge.json",
119121
".openpublishing.redirection.learning.json",
120122
".openpublishing.redirection.lighthouse.json",
121123
".openpublishing.redirection.loop.json",
124+
".openpublishing.redirection.lti.json",
122125
".openpublishing.redirection.managed-desktop.json",
126+
".openpublishing.redirection.scheduler.json",
123127
".openpublishing.redirection.security.json",
124128
".openpublishing.redirection.solutions.json",
125129
".openpublishing.redirection.syntex.json",
126-
".openpublishing.redirection.topics.json",
127-
".openpublishing.redirection.lti.json",
128-
".openpublishing.redirection.viva.json",
129130
".openpublishing.redirection.test-base.json",
130-
".openpublishing.redirection.scheduler.json",
131-
".openpublishing.redirection.defender.json"
131+
".openpublishing.redirection.topics.json",
132+
".openpublishing.redirection.viva.json"
132133
]
133134
}

0 commit comments

Comments
 (0)