4.6 KiB
4.6 KiB
"ANSI to HTML" Action For GitHub Actions
A Github Action that converts ANSI color sequences to HTML friendly HEX codes.
Table of Contents
Inputs
pathRequired The path to the file containing ANSI color codes. ORinputRequired The raw input containing ANSI color codes.encodingOptional The encoding for the raw input. Defaults to utf8.
Note, only path or input may be specified at a time.
Outputs
contentsRequired 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
About the Author
Justin McCormick is a DevOps Engineer based in Indianapolis, IN specializing in AWS based microservices.