Skip to content

Commit 5ea4350

Browse files
authored
Merge branch 'main' into fix/invokeprompt-12157
2 parents f2b64b7 + cbf6359 commit 5ea4350

File tree

981 files changed

+6137
-3595
lines changed

Some content is hidden

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

981 files changed

+6137
-3595
lines changed

.github/actions/.pwsh/scripts/Test-Authorization.ps1

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ param(
6969
[Parameter(Mandatory, ParameterSetName='Path')]
7070
[string[]]$TargetPath,
7171
[ValidateSet('Admin', 'Maintain', 'Pull', 'Push', 'Triage')]
72-
[string[]]$ValidPermissions = @('Admin', 'Maintain')
72+
[string[]]$ValidPermissions = @('Admin', 'Maintain'),
73+
[string[]]$AuthorizedAccounts
7374
)
7475

7576
begin {
@@ -101,6 +102,10 @@ begin {
101102
Console = Format-ConsoleStyle -Text $User -DefinedStyle UserName
102103
Markdown = "``$User``"
103104
}
105+
AuthorizedAccounts = @{
106+
Console = Format-ConsoleStyle -Text 'AuthorizedAccounts' -DefinedStyle Success
107+
Markdown = '`AuthorizedAccounts`'
108+
}
104109
}
105110
if (![string]::IsNullOrEmpty($TargetBranch)) {
106111
$ConsoleBranch = Format-ConsoleStyle -Text $TargetBranch -StyleComponent $TargetStyle
@@ -123,6 +128,19 @@ begin {
123128
}
124129

125130
process {
131+
if ($AuthorizedAccounts.Count -gt 0 -and $User -in $AuthorizedAccounts) {
132+
$template = "Account {0} is explicitly permitted per the {1} parameter."
133+
$message = @{
134+
summary = ($template -f $Texts.Author.Markdown, $Texts.AuthorizedAccounts.Markdown)
135+
console = ($template -f $Texts.Author.Console, $Texts.AuthorizedAccounts.Console)
136+
}
137+
$null = $Summary.AppendLine('## Authorization').AppendLine()
138+
$null = $Summary.AppendLine($message.summary).AppendLine()
139+
# Console Logging
140+
$message.console
141+
142+
return
143+
}
126144
try {
127145
$Permissions = Get-AuthorPermission -Owner $Owner -Repo $Repo -Author $User
128146
} catch {
@@ -149,7 +167,7 @@ process {
149167
"$Prefix`t$Setting"
150168
}
151169
#endregion Permission Retrieval Messaging
152-
170+
153171
$null = $Summary.AppendLine('## Result').AppendLine()
154172

155173
# Check for authorization; if the user has any of the valid permissions, they

.github/actions/commenting/expectations/v1/Parameters.psd1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
Parameters = @(
33
@{
4-
Name = 'Repository'
4+
Name = 'repository'
55
Type = 'string'
66
IfNullOrEmpty = {
77
param($ErrorTarget)
@@ -31,7 +31,7 @@
3131
}
3232

3333
@{
34-
Name = 'Message_Body'
34+
Name = 'message_body'
3535
Type = 'String'
3636
IfNullOrEmpty = {
3737
param($ErrorTarget)
@@ -75,7 +75,7 @@
7575
}
7676

7777
@{
78-
Name = 'Message_Path'
78+
Name = 'message_path'
7979
Type = 'String'
8080
IfNullOrEmpty = {
8181
param($ErrorTarget)

.github/actions/reporting/stale-content/v1/Parameters.psd1

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
Parameters = @(
33
@{
4-
Name = 'Relative_Folder_Path'
4+
Name = 'relative_folder_path'
55
Type = 'String[]'
66
IfNullOrEmpty = {
77
param($ErrorTarget)
@@ -33,7 +33,7 @@
3333
}
3434

3535
@{
36-
Name = 'Exclude_Folder_Segment'
36+
Name = 'exclude_folder_segment'
3737
Type = 'String[]'
3838
IfNullOrEmpty = {
3939
param($ErrorTarget)
@@ -56,7 +56,7 @@
5656
}
5757

5858
@{
59-
Name = 'Days_Until_Stale'
59+
Name = 'days_until_stale'
6060
Type = 'Int'
6161
IfNullOrEmpty = {
6262
param($ErrorTarget)
@@ -91,7 +91,7 @@
9191
}
9292

9393
@{
94-
Name = 'Stale_Since_Date'
94+
Name = 'stale_since_date'
9595
Type = 'DateTime'
9696
IfNullOrEmpty = {
9797
param($ErrorTarget)
@@ -125,7 +125,7 @@
125125
}
126126

127127
@{
128-
Name = 'Upload_Artifact'
128+
Name = 'upload_artifact'
129129
Type = 'Bool'
130130
IfNullOrEmpty = {
131131
param($ErrorTarget)
@@ -166,7 +166,7 @@
166166
}
167167

168168
@{
169-
Name = 'Export_As_Csv'
169+
Name = 'export_as_csv'
170170
Type = 'Bool'
171171
IfNullOrEmpty = {
172172
param($ErrorTarget)
@@ -206,7 +206,7 @@
206206
}
207207

208208
@{
209-
Name = 'Export_Path'
209+
Name = 'export_path'
210210
Type = 'string'
211211
IfNullOrEmpty = {
212212
param($ErrorTarget)

.github/actions/reporting/versioned-content/v1/Parameters.psd1

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
Parameters = @(
33
@{
4-
Name = 'Repository'
4+
Name = 'repository'
55
Type = 'String'
66
IfNullOrEmpty = {
77
param($ErrorTarget)
@@ -31,7 +31,7 @@
3131
}
3232

3333
@{
34-
Name = 'Number'
34+
Name = 'number'
3535
Type = 'Int'
3636
IfNullOrEmpty = {
3737
param($ErrorTarget)
@@ -61,7 +61,7 @@
6161
}
6262

6363
@{
64-
Name = 'Include_Path_Pattern'
64+
Name = 'include_path_pattern'
6565
Type = 'String[]'
6666
IfNullOrEmpty = {
6767
# It's okay if this parameter is not specified.
@@ -84,7 +84,7 @@
8484
}
8585
}
8686
@{
87-
Name = 'Exclude_Path_Pattern'
87+
Name = 'exclude_path_pattern'
8888
Type = 'String[]'
8989
IfNullOrEmpty = {
9090
# It's okay if this parameter is not specified.

.github/actions/verification/authorization/v1/Parameters.psd1

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
Parameters = @(
33
@{
4-
Name = 'Repository'
4+
Name = 'repository'
55
Type = 'string'
66
IfNullOrEmpty = {
77
param($ErrorTarget)
@@ -29,9 +29,26 @@
2929
return $Parameters
3030
}
3131
}
32+
@{
33+
Name = 'authorized_accounts'
34+
Type = 'String[]'
35+
Process = {
36+
param($Parameters, $Value, $ErrorTarget)
37+
38+
[string[]]$SpecifiedAccounts = $Value -split ',' | Where-Object {
39+
-not [string]::IsNullOrEmpty($_)
40+
}
41+
42+
if ($SpecifiedAccounts.Count -gt 0) {
43+
$Parameters.AuthorizedAccounts = $SpecifiedAccounts
44+
Write-HostParameter -Name AuthorizedAccounts -Value $Parameters.AuthorizedAccounts
45+
}
46+
return $Parameters
47+
}
48+
}
3249

3350
@{
34-
Name = 'Permissions'
51+
Name = 'permissions'
3552
Type = 'String[]'
3653
IfNullOrEmpty = {
3754
param($ErrorTarget)
@@ -99,7 +116,7 @@
99116
}
100117

101118
@{
102-
Name = 'Target'
119+
Name = 'target'
103120
Type = 'String[]'
104121
IfNullOrEmpty = {
105122
param($ErrorTarget)
@@ -172,7 +189,7 @@
172189
}
173190

174191
@{
175-
Name = 'User'
192+
Name = 'user'
176193
Type = 'String'
177194
IfNullOrEmpty = {
178195
param($ErrorTarget)
@@ -203,4 +220,4 @@
203220
}
204221
}
205222
)
206-
}
223+
}

.github/actions/verification/authorization/v1/action.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,16 @@ description: |
44
branch of a repository or to submit a PR editing repo configuration.
55
author: PowerShell Docs Team
66
inputs:
7+
authorized_accounts:
8+
description: |
9+
Defines one or more authorized accounts to skip permission-checking for. This is best used
10+
for bot accounts, which may not have specific permissions to a repository but are used by
11+
the organization's automation. Must be a comma-separated string of account names.
12+
13+
If a user is in the authorized accounts list, the action skips checking permissions and
14+
passes for that user.
15+
required: false
16+
default: ''
717
permissions:
818
description: |
919
The permissions a user requires to perform a given task. Must be a comma-separated string of
@@ -84,6 +94,7 @@ runs:
8494
INPUT_PERMISSIONS: ${{ inputs.permissions }}
8595
INPUT_TARGET: ${{ inputs.target }}
8696
INPUT_USER: ${{ inputs.user }}
97+
INPUT_AUTHORIZED_ACCOUNTS: ${{ inputs.authorized_accounts }}
8798
GITHUB_TOKEN: ${{ inputs.token }}
8899
run: |
89100
Write-Output "::group::Generic Setup"

.github/actions/verification/authorization/v1/readme.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,18 @@ jobs:
5454
uses: MicrosoftDocs/PowerShell-Docs/.github/actions/verification/authorization/v1@main
5555
with:
5656
token: ${{ github.token }}
57+
authorized_accounts: 'learn-build-service-prod[bot]'
5758
```
5859
5960
This workflow uses the `pull_request_target` trigger to check whether a Pull Request author is
6061
permitted to submit their Pull Request to the `live` branch. It only runs on Pull Requests which
6162
target the `live` branch, so other Pull Requests don't get a skipped message for this check.
6263

6364
It passes the GitHub token to the action but does not specify a target, relying on the default for
64-
that input, which is the `live` branch.
65+
that input, which is the `live` branch. It does specify that the `learn-build-service-prod[bot]`
66+
managed account is authorized with the `authorized_accounts` parameter. If the account creating a
67+
PR to the `live` branch is the managed account or has either the `Maintain` or `Admin` permission,
68+
the workflow will pass.
6569

6670
### Verifying authorization to change sensitive files
6771

@@ -104,6 +108,21 @@ authorization to change files in those paths.
104108

105109
## Inputs
106110

111+
### `authorized_accounts`
112+
113+
Defines one or more authorized accounts to skip permission-checking for. This is best used for bot
114+
accounts, which may not have specific permissions to a repository but are used by the
115+
organization's automation. Must be a comma-separated string of account names.
116+
117+
If a user is in the authorized accounts list, the action skips checking permissions and passes for
118+
that user.
119+
120+
```yaml
121+
required : false
122+
type : string
123+
default : ''
124+
```
125+
107126
### `permissions`
108127

109128
The permissions a user requires to perform a given task. Must be a comma-separated string of valid

.github/actions/verification/checklist/v1/Parameters.psd1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
@{
22
Parameters = @(
33
@{
4-
Name = 'Body'
4+
Name = 'body'
55
Type = 'string'
66
IfNullOrEmpty = {
77
param($ErrorTarget)
@@ -30,7 +30,7 @@
3030
}
3131

3232
@{
33-
Name = 'Reference_Url'
33+
Name = 'reference_url'
3434
Type = 'string'
3535
IfNullOrEmpty = {
3636
param($ErrorTarget)

.github/workflows/checklist.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
steps:
2525
- name: Checkout Repository
2626
id: checkout_repo
27-
uses: actions/checkout@v4
27+
uses: actions/checkout@v5
2828
- name: Verify Checklist
2929
id: verify_checklist
3030
uses: ./.github/actions/verification/checklist/v1

.github/workflows/expectations.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ jobs:
2020
steps:
2121
- name: Checkout Repository
2222
id: checkout_repo
23-
uses: actions/checkout@v4
23+
uses: actions/checkout@v5
2424
- name: Comment on Community PRs
2525
uses: ./.github/actions/commenting/expectations/v1
2626
with:

0 commit comments

Comments
 (0)