Skip to content

Bug Report: Write-ActionDebug output leaks into function return values and workflow summary markdown #448

@felickz

Description

@felickz

Issue Details

When Write-ActionDebug is called inside a PowerShell function that returns a value, the debug output is captured as part of the function's return value instead of being sent only to the GitHub Actions debug log. This causes debug messages to leak into workflow summaries, step outputs, and any other content generated by functions.

Impact:

  • ❌ Cannot use Write-ActionDebug inside functions that generate user-facing output (markdown tables, summaries, etc.)
  • ❌ Forces developers to either skip debug logging or pollute output with debug annotations
  • ❌ Breaks markdown formatting in workflow summaries

Current Workaround:
Avoid calling Write-ActionDebug inside functions that return values used for output.

Steps to reproduce the issue

Import-Module GitHubActions

function Get-LinkWithDebug {
    $url = "https://example.com"
    Write-ActionDebug "Fetching URL: $url"
    return "[$url]($url)"
}

$markdown = Get-LinkWithDebug
Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $markdown

Verbose logs showing the problem

Expected output in workflow summary:

[https://example.com](https://example.com)

Actual output in workflow summary:

::debug::Fetching URL: https://example.com
[https://example.com](https://example.com)

The debug annotation appears as visible text in the workflow summary instead of being sent only to the debug log.

Suggested solution to the issue

Write-ActionDebug should write directly to the GitHub Actions workflow command file or output stream in a way that doesn't get captured by PowerShell's function return mechanism (similar to how Write-Host outputs directly to the console without being captured).

The function should use a method that bypasses PowerShell's output stream capture, ensuring debug messages only go to the Actions debug log and not into function return values.

Requested Assignment

I'm just reporting this problem, but don't want to fix it.

Operating System

GitHub Actions runner: windows-latest

PowerShell Version

PowerShell 7.x (GitHub Actions default)

Module Version

Running: 1.1.0.2
Installed: 1.1.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugThis relates to a bug in the existing module.triage neededAn issue that needs to be reviewed by a member of the team.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions