diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..6598e0a --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,39 @@ +# Contributing + +We love your input! We want to make contributing to this project as easy and transparent as possible, whether it's: + +- Reporting a bug +- Discussing the current state of the code +- Submitting a fix +- Proposing new features +- Becoming a maintainer + + +## We Develop with Github + +We use github to host code, to track issues and feature requests, as well as accept pull requests. + + +## We Use [Github Flow](https://guides.github.com/introduction/flow/index.html), So All Code Changes Happen Through Pull Requests + +Pull requests are the best way to propose changes to the codebase (we use +[Github Flow](https://guides.github.com/introduction/flow/index.html)). We actively welcome your pull requests: + +1. Fork the repo and create your branch from `master`. +2. If you've added code that should be tested, add tests. +3. If you've changed APIs, update the documentation. +4. Ensure the test suite passes. +5. Make sure your code lints. +6. Issue that pull request! + + +## Any contributions you make will be under the Apache License 2.0 Software License +In short, when you submit code changes, your submissions are understood to be under the same +[Apache 2.0 License](https://choosealicense.com/licenses/apache-2.0/) that covers the project. Feel free to +contact the maintainers if that's a concern. + + +## Use a Consistent Coding Style + +Code style strictly enforced via eslint and prettier. Ensure your code meets our standards by running +`npm run lint --fix` prior to submitting your PR. diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md new file mode 100644 index 0000000..30c24a8 --- /dev/null +++ b/.github/ISSUE_TEMPLATE.md @@ -0,0 +1,20 @@ + +---- + +### All Submissions: + +Do the checklist before filing an issue: + +- [ ] Are you using the latest version of anti-to-html-action? +- [ ] Is this something you can **debug and fix**? Send a pull request! Bug fixes and documentation fixes are welcome. +- [ ] Is a color being escaped incorrectly? We use [ansi-to-html](https://github.com/rburns/ansi-to-html) and issues related to color discrepancies should be created there. +- [ ] Have a usage question? Ask your question on [StackOverflow](http://stackoverflow.com). We use StackOverflow for usage question and GitHub for bugs. + + +None of the above, create a bug report +------------------------------------------------------------------ + +Make sure to add **all the information needed to understand the bug** so that someone can help. If the info is missing we'll add the 'Needs more information' label and close the issue until there is enough information. + +- [ ] Provide a **minimal code snippet** +- [ ] Provide a link to a failed workflow, if possible. diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..aedca1c --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,12 @@ + +---- + +### All Submissions: + +**IMPORTANT: Please do not create a Pull Request without creating an issue first.** + +*Any change needs to be discussed before proceeding. Failure to do so may result in the rejection of the pull request.* + +* [ ] Have you followed the guidelines in our [Contributing guide?](https://github.com/justinm/ansi-to-html-action/blob/master/.github/CONTRIBUTING.md) + +*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license* \ No newline at end of file diff --git a/README.md b/README.md index 08bd6d1..5d6b66d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ ## "ANSI to HTML" Action For GitHub Actions A Github Action that converts ANSI color sequences to HTML friendly HEX codes. +
[![Contributors][contributors-shield]][contributors-url] @@ -10,17 +11,42 @@ A Github Action that converts ANSI color sequences to HTML friendly HEX codes. [![MIT License][license-shield]][license-url]
+ **Table of Contents** -- [Usage](#usage) +- [Examples](#examples) - [Contributors](#contributors) - [Sponsoring](#sponsoring) -## Usage + +## 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. + +```yaml + - 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. diff --git a/action.yml b/action.yml index 897cbf4..8c9f13a 100644 --- a/action.yml +++ b/action.yml @@ -6,18 +6,18 @@ branding: color: "blue" inputs: input: - description: "The raw input containing ANSI color codes" + description: "The raw input containing ANSI color codes. An input or path must be specified, but not both." required: false path: - description: "The raw input containing ANSI color codes" + description: "The path to the file containing ANSI color codes. An input or path must be specified, but not both." required: false encoding: - description: "The encoding for the raw input. Defaults to utf8" + description: "The encoding for the raw input. Defaults to utf8." default: "utf8" required: true outputs: contents: - description: "A version of 'input' where all ANSI codes have been replaced with HTML color codes." + description: "The input or contents of path where all ANSI codes have been replaced with HTML color codes." runs: using: "node16" main: "./index.js"