Skip to content
ConsoleMonster
Cmdlet

Write-ConsoleAnnotation

Module
ConsoleMonster
Outputs
System.Void

Writes a CI error, warning or notice, or a styled terminal status line.

Syntax

Write-ConsoleAnnotation
[-Column <Int32>]
[-File <String>]
-Level <Error|Warning|Notice>
[-Line <Int32>]
-Message <String>
[-Title <String>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

GitHub Actions and Azure Pipelines receive native annotations with escaped literal text. Azure notices and GitLab annotations are ordinary lines. Other hosts show a status line with a source-file link where supported. This command does not change the process exit code or write to PowerShell's error stream.

Examples

Example 1

Write-ConsoleAnnotation -Level Error -Message 'Missing configuration' -File ./build.ps1 -Line 12 -Column 5

Point to a build error

Example 2

$result = [pscustomobject]@{ Name = 'Inventory'; Detail = 'Two servers need an update' }
Write-ConsoleAnnotation -Level Warning -Title $result.Name -Message $result.Detail

Highlight an inventory warning in a CI log

Parameters

-Column Int32 optional
The one-based source column.
-File String optional
The optional source file; relative paths resolve from the current PowerShell location. Files inside the provider workspace use checkout-relative paths with forward slashes; outside paths stay as supplied. Terminal labels are relative to the current location and show the file and line once, linked where supported.
-Level AnnotationLevel required
Error, Warning or Notice.
Possible values: Error, Warning, Notice
-Line Int32 optional
The one-based source line.
-Message String required
The literal annotation text.
-Title String optional
An optional title; Azure and plain lines prepend it to the message.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.