Skip to content

Commit

Permalink
Add helpers to log a GitHub "notice" (Azure#38574)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike Harder <mharder@microsoft.com>
  • Loading branch information
2 people authored and allenkim0129 committed Nov 18, 2024
1 parent ae91385 commit faf6625
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions eng/common/scripts/logging.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,26 @@ function LogInfo {
Write-Host "$args"
}

function LogNotice {
if (Test-SupportsGitHubLogging) {
Write-Host ("::notice::$args" -replace "`n", "%0D%0A")
}
else {
# No equivalent for DevOps
Write-Host "[Notice] $args"
}
}

function LogNoticeForFile($file, $noticeString) {
if (Test-SupportsGitHubLogging) {
Write-Host ("::notice file=$file,line=1,col=1::$noticeString" -replace "`n", "%0D%0A")
}
else {
# No equivalent for DevOps
Write-Host "[Notice in file $file] $noticeString"
}
}

function LogWarning {
if (Test-SupportsDevOpsLogging) {
Write-Host ("##vso[task.LogIssue type=warning;]$args" -replace "`n", "%0D%0A")
Expand Down

0 comments on commit faf6625

Please sign in to comment.