GitHub - atlasfutures/claude-output-formatter: GitHub Action to format Claude Code Action execution results with enhanced formatting (original) (raw)

A GitHub Action that enhances Claude Code Action execution results with beautiful formatting and rich GitHub integration.

Features

Quick Start

Inputs

Input Description Required Default
execution_file Path to the Claude execution JSON file โœ… -
format_type Output format (markdown, html, json) โŒ markdown
output_file Custom output file path โŒ Auto-generated
update_step_summary Update GitHub step summary โŒ true
create_comment Create/update PR/issue comment โŒ false
comment_tag Tag to identify comments for updates โŒ claude-output-formatter
include_raw_data Include raw conversation data โŒ false
max_content_length Maximum length for content blocks (0 = unlimited) โŒ 1000
theme Theme for HTML output (light, dark, auto) โŒ auto

Outputs

Output Description
formatted_file Path to the formatted output file
summary_updated Whether the step summary was updated
comment_id ID of the created/updated comment
total_tokens Total tokens used in the conversation
total_cost Total cost of the conversation
execution_status Overall execution status (success/error)

Usage Examples

Basic Usage

HTML Output with Custom Theme

JSON Output with Raw Data

PR Comment Integration

Complete Workflow Example

name: Claude Code Review

on: pull_request: types: [opened, synchronize]

jobs: claude-review: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4

  - name: Claude Code Analysis
    uses: anthropics/claude-code-action@main
    id: claude
    with:
      prompt: "Please review this pull request for potential issues"
      
  - name: Format Results
    uses: atlasfutures/claude-output-formatter@v1
    with:
      execution_file: ${{ steps.claude.outputs.execution_file }}
      format_type: markdown
      create_comment: true
      update_step_summary: true
      max_content_length: 2000
    env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
      
  - name: Save HTML Report
    uses: atlasfutures/claude-output-formatter@v1
    with:
      execution_file: ${{ steps.claude.outputs.execution_file }}
      format_type: html
      output_file: ./claude-report.html
      theme: auto
      
  - name: Upload Report
    uses: actions/upload-artifact@v4
    with:
      name: claude-analysis-report
      path: ./claude-report.html

Output Formats

Markdown

The markdown format provides:

HTML

The HTML format includes:

JSON

The JSON format offers:

GitHub Integration

Step Summary

When update_step_summary is enabled, the action automatically updates the GitHub Actions step summary with the formatted output. For non-markdown formats, it provides a summary of the formatting operation.

PR/Issue Comments

When create_comment is enabled, the action will:

  1. Look for existing comments with the specified tag
  2. Update existing comments or create new ones
  3. Format the content appropriately for the output type
  4. Include timestamps and formatting metadata

Performance

The action is optimized for performance:

Performance benchmarks:

Error Handling

The action includes robust error handling:

Development

Setup

Clone the repository

git clone https://github.com/atlasfutures/claude-output-formatter.git cd claude-output-formatter

Install dependencies

bun install

Run tests

bun test

Build the action

bun run build

Testing

Run all tests

bun test

Run with coverage

bun test --coverage

Run performance tests

bun test tests/performance.test.ts

Watch mode for development

bun test --watch

Formatting and Linting

Format code

bun run format

Check formatting

bun run format:check

Lint code

bun run lint

Fix linting issues

bun run lint:fix

Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests for new functionality
  5. Ensure all tests pass
  6. Submit a pull request

License

MIT License - see LICENSE for details.

Support

For issues and questions:

Changelog

v1.0.0