actions / actions/toolkit

To offer built-in color output as option

Open
#692 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

core enhancement
Dominant language
TypeScript
Stars
5.9k
Forks
1.8k
PR merge metrics
No merged PRs in 30d

Description

Describe the enhancement
After color output improvements (link and https://github.com/actions/toolkit/pull/583) I think it could be interesting to integrate to this toolkit, as an option disabled by default, color output for the following methods

https://github.com/actions/toolkit/blob/85f6235ca99674b76ff1dbde0683a5e9df71e1d2/packages/core/src/core.ts#L144-L170

Code Snippet

Current

https://github.com/actions/toolkit/blob/85f6235ca99674b76ff1dbde0683a5e9df71e1d2/packages/core/src/command.ts#L32-L34

Change Proposal
import { red, yellow } from 'whatever-lib-to-color-output'

const logColors = {
	error: red,
    warning: yellow
}

...

function issue(name: string, message: string = '', useColoredMessage: boolean = false): void {
	if(!useColoredMessage) issueCommand(name, {}, message)
	else {
		const paintMessage = logColors[name]
		const paintedMessage = paintMessage? paintMessage(message) : message

		issueCommand(name, {}, paintMessage(paintedMessage))
	}
}

Additional information
Here are some comparisons for some packages for coloring the output:

In case this feature has sense, I guess it will need to be discussed how and which external package or internal utility to use.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/core/src/core.ts lines 144-170 and packages/core/src/command.ts lines 32-34 to map the affected methods and current command output. Review the proposed optional coloring behavior and compare the listed package choices or an internal utility. Done means color output is available as a disabled-by-default option for the specified methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.