Skip to content
Draft
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
1 change: 1 addition & 0 deletions .github/workflows/test-action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ jobs:
include_public_tests: true
include_private_tests: false
include_exchange: false
include_purview: false
include_teams: false
step_summary: ${{ matrix.maester == 'preview'}}
artifact_upload: true
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Check out the [Maester documentation](https://maester.dev/) for more information
| `include_public_tests` | Install public tests from module | ❌ | `true` |
| `include_private_tests` | Include private tests from the current repository. | ❌ | `true` |
| `include_exchange` | Include Exchange Online tests in the test run. | ❌ | `false` |
| `include_purview` | Include Purview tests in the test run. | ❌ | `false` |
| `include_teams` | Include Teams tests in the test run. | ❌ | `true` |
| `include_tags` | A list of tags to include in the test run (comma-separated). | ❌ | |
| `exclude_tags` | A list of tags to exclude from the test run (comma-separated). | ❌ | |
Expand Down Expand Up @@ -97,6 +98,7 @@ jobs:
include_public_tests: true
include_private_tests: false
include_exchange: false
include_purview: false
include_teams: false
# Set a specific version of the powershell module here or 'latest' or 'preview'
# check out https://www.powershellgallery.com/packages/Maester/
Expand Down
6 changes: 6 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ inputs:
description: "Include Exchange Online tests in the test run."
required: false
default: false
include_purview:
type: boolean
description: "Include Purview tests in the test run."
required: false
default: false
include_teams:
type: boolean
description: "Include Teams tests in the test run."
Expand Down Expand Up @@ -153,6 +158,7 @@ runs:
-MaesterVersion '${{ inputs.maester_version }}' `
-IncludePublicTests('${{ inputs.include_public_tests }}' -eq 'true') `
-IncludeExchange ('${{ inputs.include_exchange }}' -eq 'true') `
-IncludePurview ('${{ inputs.include_purview }}' -eq 'true') `
-IncludeTeams ('${{ inputs.include_teams }}' -eq 'true') `
-IncludeTags '${{ inputs.include_tags }}' `
-ExcludeTags '${{ inputs.exclude_tags }}' `
Expand Down
28 changes: 23 additions & 5 deletions script/Run-MaesterAction.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@
[Parameter(Mandatory = $false, HelpMessage = 'Include Exchange Online tests')]
[bool]$IncludeExchange = $true,

[Parameter(Mandatory = $false, HelpMessage = 'Include Purview tests')]
[bool]$IncludePurview = $false,

[Parameter(Mandatory = $false, HelpMessage = 'Include Teams tests')]
[bool]$IncludeTeams = $true,

Expand Down Expand Up @@ -142,10 +145,25 @@ PROCESS {
Import-Module ExchangeOnlineManagement

$outlookToken = Get-MtAccessTokenUsingCli -ResourceUrl 'https://outlook.office365.com'
Connect-ExchangeOnline -AccessToken $outlookToken -AppId $ClientId -Organization $TenantId -ShowBanner:$false
Write-Host "✔️ Exchange Online connected."
} else {
Write-Host '📃 Exchange Online tests will be skipped.'

# Check if we need to connect to Exchange Online
if ($IncludeExchange) {
Connect-ExchangeOnline -AccessToken $outlookToken -AppId $ClientId -Organization $TenantId -ShowBanner:$false
Write-Host "✔️ Exchange Online connected."
} else {
Write-Host '📃 Exchange Online tests will be skipped.'
}

# Check if we need to connect to Purview
if ($IncludePurview) {
$domains = Invoke-MgGraphRequest -Uri "https://graph.microsoft.com/v1.0/domains?`$select=id,isDefault"
$primaryDomain = $domains.value | Where-Object { $_.isDefault -eq $true } | Select-Object -ExpandProperty id

Connect-IPPSSession -AccessToken $outlookToken -Organization $primaryDomain -ShowBanner:$false
Write-Host "✔️ Purview connected."
} else {
Write-Host '📃 Purview tests will be skipped.'
}
}

# Check if we need to connect to Teams
Expand All @@ -157,7 +175,7 @@ PROCESS {

$regularGraphToken = ConvertFrom-SecureString -SecureString $graphToken -AsPlainText
$tokens = @($regularGraphToken, $teamsToken)
Connect-MicrosoftTeams -AccessTokens $tokens -Verbose
Connect-MicrosoftTeams -AccessTokens $tokens
Write-Host "✔️ Microsoft Teams connected."
} else {
Write-Host '📃 Teams tests will be skipped.'
Expand Down