maester365 / maester

The core repository for the Maester module with helper cmdlets that will be called from the Pester tests.
https://maester.dev
MIT License
334 stars 80 forks source link

Email Alerts error: A parameter cannot be found that matches parameter name 'Results' #146

Closed fdicarlo closed 6 months ago

fdicarlo commented 6 months ago

I have added the following step in my GitHub Action:

- name: Send Email Report uses: azure/powershell@v2 if: always() with: inlineScript: | $userId = "XXX-XXX-XXX-XXX" $recipients = "XXXX@XXXX.slack.com" $testResultsUri = "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}" Send-MtMail -Results $results -Recipient $recipients -UserId $userId -TestResultsUri $testResultsUri azPSVersion: "latest"

but unfortunately I am getting the following error:

/usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command $env:PSModulePath /home/runner/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/7/Modules /usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command try { $ErrorActionPreference = "Stop" $WarningPreference = "SilentlyContinue" $output = @{} $data = Get-Module -Name Az -ListAvailable | Sort-Object Version -Descending | Select-Object -First 1 $output['AzVersion'] = $data.Version.ToString() $output['Success'] = "true" } catch { $output['Error'] = $_.exception.Message } return ConvertTo-Json $output True { "AzVersion": "11.3.1", "Success": "true" } /usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command $env:PSModulePath /usr/share:/home/runner/.local/share/powershell/Modules:/usr/local/share/powershell/Modules:/opt/microsoft/powershell/7/Modules Initializing Az Module Complete Running Az PowerShell Script /usr/bin/pwsh -NoLogo -NoProfile -NonInteractive -Command /home/runner/work/_temp/c0ea7ee0-93ad-4[25](https://github.com/OrgName/maester-tests/actions/runs/8836990743/job/24264800508#step:8:26)7-9909-4135e42d46da.ps1 Send-MtMail: /home/runner/work/_temp/c0ea7ee0-93ad-4257-9909-4135e42d46da.ps1:5 Line | 5 | Send-MtMail -Results $results -Recipient $recipients -UserId $userId … | ~~~~~~~~ | A parameter cannot be found that matches parameter name 'Results'.

Based on my initial troubleshooting the error message suggests that the cmdlet Send-MtMail does not recognize a parameter named -Results. This implies either a typo in the parameter name, or possibly a version issue with the module, or even a misunderstanding of the cmdlet's available parameters. But I am not sure how to proceed here.

merill commented 6 months ago

The parameter name is -MaesterResults.

See https://maester.dev/docs/commands/Send-MtMail

CleanShot 2024-04-26 at 08 22 28@2x