Files
actions-ansi-to-html/README.md
T
2022-08-16 03:16:01 -04:00

4.6 KiB

"ANSI to HTML" Action For GitHub Actions

A Github Action that converts ANSI color sequences to HTML friendly HEX codes.

Contributors Forks Stargazers Issues MIT License

Table of Contents

Inputs

  • path Required The path to the file containing ANSI color codes. OR
  • input Required The raw input containing ANSI color codes.
  • encoding Optional The encoding for the raw input. Defaults to utf8.

Note, only path or input may be specified at a time.

Outputs

  • contents Required The input or contents of path where all ANSI codes have been replaced with HTML color codes. OR

Examples

Read a file from disk that contains ANSI color escape sequences, escape its contents and echo its contents to an active pull request.

    - run: echo -en "\e[36mSample Text\e[0m" | tee output.log
    - id: output-log
      uses: justinm/ansi-to-html-action@v0
      with:
        path: ./output.log
    - run: echo "${{ steps.output-log.outputs.contents }}"

Read a file from disk that contains ANSI color escape sequences, escape its contents and post its contents to an active pull request.

jobs:
  build:
    permissions:
      contents: read
      pull-requests: write
    steps:
    - run: ./doSomething.sh | tee output.log
    - id: output-log
      uses: justinm/ansi-to-html-action@v0
      with:
        path: ./output.log
    - run: echo "${{ steps.output-log.outputs.contents }}"
    - if: ${{ github.event_name == 'pull_request' }}
      uses: thollander/actions-comment-pull-request@v1
      permissions:
        contents: read
        pull-requests: write
      with:
        message: |
          <details>
          <summary>output.log</summary>
          \`\`\`
          ${{ steps.output-log.outputs.content }}
          \`\`\`
          </details>
          *${{ steps.resolve-comment-id.outputs.comment-id }}*
        GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
        comment_includes: ${{ steps.resolve-comment-id.outputs.comment-id }}

Contributors

Contributors

About the Author

Justin McCormick is a DevOps Engineer based in Indianapolis, IN specializing in AWS based microservices.

LinkedIn

Sponsoring

Github Sponsors Patreon Contributors