2021-09-18 21:21:22 +08:00
|
|
|
import * as core from "@actions/core"
|
2022-08-08 09:48:41 +08:00
|
|
|
import ciDetect from "@npmcli/ci-detect"
|
2021-09-18 21:21:22 +08:00
|
|
|
|
|
|
|
export function error(err: string | Error) {
|
2022-08-08 10:13:40 +08:00
|
|
|
return ciDetect() === "github-actions" ? core.error(err) : console.log(`\x1b[31m${err}\x1b[0m`)
|
2021-09-18 21:21:22 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
export function success(msg: string) {
|
2022-04-18 18:25:01 +08:00
|
|
|
return console.log(`\x1b[32m${msg}\x1b[0m`)
|
2021-09-18 21:21:22 +08:00
|
|
|
}
|
2022-01-30 07:13:52 +08:00
|
|
|
|
|
|
|
export function warning(msg: string) {
|
2022-08-08 10:13:40 +08:00
|
|
|
return ciDetect() === "github-actions" ? core.warning(msg) : console.log(`\x1b[33m${msg}\x1b[0m`)
|
2022-01-30 07:15:35 +08:00
|
|
|
}
|
2022-04-16 15:30:53 +08:00
|
|
|
|
2022-05-03 12:38:39 +08:00
|
|
|
export function notice(msg: string) {
|
2022-08-08 10:13:40 +08:00
|
|
|
return ciDetect() === "github-actions" ? core.notice(msg) : console.log(`\x1b[94m${msg}\x1b[0m`)
|
2022-05-03 12:38:39 +08:00
|
|
|
}
|
|
|
|
|
2022-04-16 15:30:53 +08:00
|
|
|
export function info(msg: string) {
|
2022-08-08 10:13:40 +08:00
|
|
|
return ciDetect() === "github-actions" ? core.info(msg) : console.log(msg)
|
2022-04-16 15:30:53 +08:00
|
|
|
}
|