1
1
# Requires -PSEdition Core
2
2
# Requires -Version 7.2
3
+ enum GHActionsAnnotationType {
4
+ Notice = 0
5
+ Warning = 1
6
+ Warn = 1
7
+ Error = 2
8
+ }
3
9
<#
4
10
. SYNOPSIS
5
11
GitHub Actions - Internal - Escape Characters
@@ -448,6 +454,63 @@ function Set-GHActionsState {
448
454
}
449
455
<#
450
456
. SYNOPSIS
457
+ GitHub Actions - Write Annotation
458
+ . DESCRIPTION
459
+ Prints an annotation message to the log.
460
+ . PARAMETER Type
461
+ Annotation type.
462
+ . PARAMETER Message
463
+ Message that need to log at annotation.
464
+ . PARAMETER File
465
+ Issue file path.
466
+ . PARAMETER Line
467
+ Issue file line start.
468
+ . PARAMETER Col
469
+ Issue file column start.
470
+ . PARAMETER EndLine
471
+ Issue file line end.
472
+ . PARAMETER EndColumn
473
+ Issue file column end.
474
+ . PARAMETER Title
475
+ Issue title.
476
+ . OUTPUTS
477
+ Void
478
+ #>
479
+ function Write-GHActionsAnnotation {
480
+ [CmdletBinding ()][OutputType ([void ])]
481
+ param (
482
+ [Parameter (Mandatory = $true , Position = 0 )][GHActionsAnnotationType ]$Type ,
483
+ [Parameter (Mandatory = $true , Position = 1 )][string ]$Message ,
484
+ [Parameter ()][string ]$File ,
485
+ [Parameter ()][uint ]$Line ,
486
+ [Parameter ()][uint ]$Col ,
487
+ [Parameter ()][uint ]$EndLine ,
488
+ [Parameter ()][uint ]$EndColumn ,
489
+ [Parameter ()][string ]$Title
490
+ )
491
+ [hashtable ]$Properties = @ {}
492
+ if ($File.Length -gt 0 ) {
493
+ $Properties .' file' = $File
494
+ }
495
+ if ($Line -gt 0 ) {
496
+ $Properties .' line' = $Line
497
+ }
498
+ if ($Col -gt 0 ) {
499
+ $Properties .' col' = $Col
500
+ }
501
+ if ($EndLine -gt 0 ) {
502
+ $Properties .' endLine' = $EndLine
503
+ }
504
+ if ($EndColumn -gt 0 ) {
505
+ $Properties .' endColumn' = $EndColumn
506
+ }
507
+ if ($Title.Length -gt 0 ) {
508
+ $Properties .' title' = $Title
509
+ }
510
+ Write-GHActionsCommand - Command $Type.ToString ().ToLower() - Message $Message - Properties $Properties
511
+ }
512
+ <#
513
+ . SYNOPSIS
451
514
GitHub Actions - Write Debug
452
515
. DESCRIPTION
453
516
Prints a debug message to the log.
@@ -492,39 +555,15 @@ Void
492
555
function Write-GHActionsError {
493
556
[CmdletBinding ()][OutputType ([void ])]
494
557
param (
495
- [Parameter (Mandatory = $true , Position = 0 , ValueFromPipeline = $true )][string ]$Message ,
558
+ [Parameter (Mandatory = $true , Position = 0 )][string ]$Message ,
496
559
[Parameter ()][string ]$File ,
497
560
[Parameter ()][uint ]$Line ,
498
561
[Parameter ()][uint ]$Col ,
499
562
[Parameter ()][uint ]$EndLine ,
500
563
[Parameter ()][uint ]$EndColumn ,
501
564
[Parameter ()][string ]$Title
502
565
)
503
- begin {
504
- [hashtable ]$Properties = @ {}
505
- if ($File.Length -gt 0 ) {
506
- $Properties .' file' = $File
507
- }
508
- if ($Line -gt 0 ) {
509
- $Properties .' line' = $Line
510
- }
511
- if ($Col -gt 0 ) {
512
- $Properties .' col' = $Col
513
- }
514
- if ($EndLine -gt 0 ) {
515
- $Properties .' endLine' = $EndLine
516
- }
517
- if ($EndColumn -gt 0 ) {
518
- $Properties .' endColumn' = $EndColumn
519
- }
520
- if ($Title.Length -gt 0 ) {
521
- $Properties .' title' = $Title
522
- }
523
- }
524
- process {
525
- Write-GHActionsCommand - Command ' error' - Message $Message - Properties $Properties
526
- }
527
- end {}
566
+ Write-GHActionsAnnotation - Type ' Error' - Message $Message - File $File - Line $Line - Col $Col - EndLine $EndLine - EndColumn $EndColumn - Title $Title
528
567
}
529
568
<#
530
569
. SYNOPSIS
@@ -541,7 +580,7 @@ function Write-GHActionsFail {
541
580
param (
542
581
[Parameter (Position = 0 )][string ]$Message = ' '
543
582
)
544
- Write-GHActionsCommand - Command ' error ' - Message $Message
583
+ Write-GHActionsAnnotation - Type ' Error ' - Message $Message
545
584
exit 1
546
585
}
547
586
<#
@@ -569,39 +608,15 @@ Void
569
608
function Write-GHActionsNotice {
570
609
[CmdletBinding ()][OutputType ([void ])]
571
610
param (
572
- [Parameter (Mandatory = $true , Position = 0 , ValueFromPipeline = $true )][string ]$Message ,
611
+ [Parameter (Mandatory = $true , Position = 0 )][string ]$Message ,
573
612
[Parameter ()][string ]$File ,
574
613
[Parameter ()][uint ]$Line ,
575
614
[Parameter ()][uint ]$Col ,
576
615
[Parameter ()][uint ]$EndLine ,
577
616
[Parameter ()][uint ]$EndColumn ,
578
617
[Parameter ()][string ]$Title
579
618
)
580
- begin {
581
- [hashtable ]$Properties = @ {}
582
- if ($File.Length -gt 0 ) {
583
- $Properties .' file' = $File
584
- }
585
- if ($Line -gt 0 ) {
586
- $Properties .' line' = $Line
587
- }
588
- if ($Col -gt 0 ) {
589
- $Properties .' col' = $Col
590
- }
591
- if ($EndLine -gt 0 ) {
592
- $Properties .' endLine' = $EndLine
593
- }
594
- if ($EndColumn -gt 0 ) {
595
- $Properties .' endColumn' = $EndColumn
596
- }
597
- if ($Title.Length -gt 0 ) {
598
- $Properties .' title' = $Title
599
- }
600
- }
601
- process {
602
- Write-GHActionsCommand - Command ' notice' - Message $Message - Properties $Properties
603
- }
604
- end {}
619
+ Write-GHActionsAnnotation - Type ' Notice' - Message $Message - File $File - Line $Line - Col $Col - EndLine $EndLine - EndColumn $EndColumn - Title $Title
605
620
}
606
621
<#
607
622
. SYNOPSIS
@@ -628,38 +643,14 @@ Void
628
643
function Write-GHActionsWarning {
629
644
[CmdletBinding ()][OutputType ([void ])]
630
645
param (
631
- [Parameter (Mandatory = $true , Position = 0 , ValueFromPipeline = $true )][string ]$Message ,
646
+ [Parameter (Mandatory = $true , Position = 0 )][string ]$Message ,
632
647
[Parameter ()][string ]$File ,
633
648
[Parameter ()][uint ]$Line ,
634
649
[Parameter ()][uint ]$Col ,
635
650
[Parameter ()][uint ]$EndLine ,
636
651
[Parameter ()][uint ]$EndColumn ,
637
652
[Parameter ()][string ]$Title
638
653
)
639
- begin {
640
- [hashtable ]$Properties = @ {}
641
- if ($File.Length -gt 0 ) {
642
- $Properties .' file' = $File
643
- }
644
- if ($Line -gt 0 ) {
645
- $Properties .' line' = $Line
646
- }
647
- if ($Col -gt 0 ) {
648
- $Properties .' col' = $Col
649
- }
650
- if ($EndLine -gt 0 ) {
651
- $Properties .' endLine' = $EndLine
652
- }
653
- if ($EndColumn -gt 0 ) {
654
- $Properties .' endColumn' = $EndColumn
655
- }
656
- if ($Title.Length -gt 0 ) {
657
- $Properties .' title' = $Title
658
- }
659
- }
660
- process {
661
- Write-GHActionsCommand - Command ' warning' - Message $Message - Properties $Properties
662
- }
663
- end {}
654
+ Write-GHActionsAnnotation - Type ' Warning' - Message $Message - File $File - Line $Line - Col $Col - EndLine $EndLine - EndColumn $EndColumn - Title $Title
664
655
}
665
- Export-ModuleMember - Function Add-GHActionsEnvironmentVariable , Add-GHActionsPATH , Add-GHActionsSecretMask , Disable-GHActionsCommandEcho , Disable-GHActionsProcessingCommand , Enable-GHActionsCommandEcho , Enable-GHActionsProcessingCommand , Enter-GHActionsLogGroup , Exit-GHActionsLogGroup , Get-GHActionsInput , Get-GHActionsIsDebug , Get-GHActionsState , Get-GHActionsWebhookEventPayload , Set-GHActionsOutput , Set-GHActionsState , Write-GHActionsDebug , Write-GHActionsError , Write-GHActionsFail , Write-GHActionsNotice , Write-GHActionsWarning
656
+ Export-ModuleMember - Function Add-GHActionsEnvironmentVariable , Add-GHActionsPATH , Add-GHActionsSecretMask , Disable-GHActionsCommandEcho , Disable-GHActionsProcessingCommand , Enable-GHActionsCommandEcho , Enable-GHActionsProcessingCommand , Enter-GHActionsLogGroup , Exit-GHActionsLogGroup , Get-GHActionsInput , Get-GHActionsIsDebug , Get-GHActionsState , Get-GHActionsWebhookEventPayload , Set-GHActionsOutput , Set-GHActionsState , Write-GHActionsAnnotation , Write- GHActionsDebug, Write-GHActionsError , Write-GHActionsFail , Write-GHActionsNotice , Write-GHActionsWarning
0 commit comments