Skip to content

Commit f51f852

Browse files
authored
Add Write-GitHub logging function for GitHub Actions (#29)
Implement a conditional logging utility that writes output only when running in GitHub Actions environment. Use it to wrap application execution logs in GitHub Actions log groups.
1 parent 3867ce5 commit f51f852

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

app-runner/Private/Logging.ps1

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,15 @@
11
# Logging Functions
2-
# This file is now empty as all public functions have been moved to the Public directory
2+
# This file contains internal logging utilities
3+
4+
function Write-GitHub {
5+
[CmdletBinding()]
6+
param(
7+
[Parameter(Mandatory = $true)]
8+
[string]$Message
9+
)
10+
11+
# Only write output if running in GitHub Actions
12+
if ($env:GITHUB_ACTIONS -eq 'true') {
13+
Write-Host $Message
14+
}
15+
}

app-runner/Public/Invoke-DeviceApp.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,13 @@ function Invoke-DeviceApp {
3131
Write-Debug "Running application: $ExecutablePath with arguments: $Arguments"
3232
Write-Debug "Target platform: $($script:CurrentSession.Platform)"
3333

34+
Write-GitHub "::group::Run log"
35+
3436
# Use the provider to run the application
3537
$provider = $script:CurrentSession.Provider
3638
$result = $provider.RunApplication($ExecutablePath, $Arguments)
3739

40+
Write-GitHub "::endgroup::"
41+
3842
return $result
39-
}
43+
}

0 commit comments

Comments
 (0)