Skip to content

fix(issue-comment): add error handling to GITHUB_OUTPUT writes in success paths #699

@rjmurillo-bot

Description

@rjmurillo-bot

Summary

The Post-IssueComment.ps1 script has unprotected Add-Content calls to $env:GITHUB_OUTPUT in the success paths. While PR #698 added proper error handling for the 403 error path, the existing success paths lack this protection.

Problem

Lines 102-111, 120-125, and 148-157 contain Add-Content calls without try-catch blocks:

# Example from success path (lines 102-111)
if ($env:GITHUB_OUTPUT) {
    Add-Content -Path $env:GITHUB_OUTPUT -Value "success=true"
    Add-Content -Path $env:GITHUB_OUTPUT -Value "skipped=false"
    # ... more writes
}

If the GITHUB_OUTPUT file becomes unwritable (disk full, permissions, locked), these operations fail silently.

Solution

Apply the same error handling pattern used in the 403 path:

if ($env:GITHUB_OUTPUT -and (Test-Path $env:GITHUB_OUTPUT -PathType Leaf)) {
    try {
        $outputs = @("success=true", "skipped=false", ...)
        $outputs | Add-Content -Path $env:GITHUB_OUTPUT -ErrorAction Stop
    }
    catch {
        Write-Warning "Failed to write GitHub Actions outputs: $_"
    }
}

Affected Files

  • .claude/skills/github/scripts/issue/Post-IssueComment.ps1

Related


🤖 Generated with Claude Code

Metadata

Metadata

Assignees

Labels

agent-qaTesting and verification agentarea-skillsSkills documentation and patternsarea-workflowsGitHub Actions workflowsbugSomething isn't workinggood first issueGood for newcomerspriority:P2Normal: Standard enhancement or bug fix, moderate impact

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions