-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added information on documentation
- Loading branch information
ADMSK\AVROGAL1
committed
Mar 27, 2021
1 parent
ed7962a
commit 0d2fe95
Showing
10 changed files
with
226 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
codecov: | ||
notify: | ||
wait_for_ci: false | ||
require_ci_to_pass: true | ||
strict_yaml_branch: master | ||
branch: master | ||
|
||
coverage: | ||
precision: 2 | ||
round: down | ||
range: "70...100" | ||
|
||
status: | ||
project: | ||
default: | ||
base: auto | ||
informational: true | ||
target: 95% | ||
threshold: 1% | ||
patch: | ||
default: | ||
informational: true | ||
target: 80% | ||
threshold: 1% | ||
changes: no | ||
|
||
notify: | ||
# Wait for reasonable amount of tests to complete before | ||
# reporting coverage | ||
after_n_builds: 8 | ||
|
||
ignore: | ||
- "**/generated/**" | ||
- "data" | ||
- "dist" | ||
- "docs" | ||
- "tests" | ||
|
||
parsers: | ||
gcov: | ||
branch_detection: | ||
conditional: yes | ||
loop: yes | ||
method: no | ||
macro: no | ||
|
||
comment: | ||
layout: "header, reach, diff, flags, files, footer" | ||
behavior: default | ||
require_changes: false | ||
require_base: false | ||
require_head: true | ||
branches: [ "master" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# [0.0.0-dev](https://github.com/AlexRogalskiy/github-action-json-fields/compare/v2.0.1...v0.0.0-dev) (2021-03-25) | ||
# [0.0.0-dev](https://github.com/AlexRogalskiy/github-action-json-fields/compare/v2.0.1...v0.0.0-dev) (2021-03-27) | ||
|
||
|
||
|
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
import * as core from '@actions/core' | ||
import dateFormat from 'dateformat' | ||
import boxen from 'boxen' | ||
|
||
import { Processor } from '../../typings/standard-types' | ||
|
||
import { profile } from './profiles' | ||
|
||
import { mergeProps } from './commons' | ||
|
||
/** | ||
* Logger | ||
* @desc Type representing logging function | ||
*/ | ||
type Logger<T, V> = (message: T, ...args: V[]) => void | ||
|
||
const DATETIME_FORMAT = 'dddd, mmmm dS, yyyy, hh:MM:ss TT' | ||
|
||
const getColor = (value: string, defaultValue = ''): string => (process.stdout.isTTY ? value : defaultValue) | ||
|
||
const COLORS = { | ||
RESET: getColor('\x1b[0m'), | ||
BLACK: getColor('\x1b[0;30m'), | ||
RED: getColor('\x1b[0;31m'), | ||
GREEN: getColor('\x1b[0;32m'), | ||
BROWN: getColor('\x1b[0;33m'), | ||
BLUE: getColor('\x1b[0;34m'), | ||
PURPLE: getColor('\x1b[0;35m'), | ||
CYAN: getColor('\x1b[0;36m'), | ||
LIGHT_GRAY: getColor('\x1b[0;37m'), | ||
DARK_GRAY: getColor('\x1b[1;30m'), | ||
LIGHT_RED: getColor('\x1b[1;31m'), | ||
LIGHT_GREEN: getColor('\x1b[1;32m'), | ||
YELLOW: getColor('\x1b[1;33m'), | ||
LIGHT_BLUE: getColor('\x1b[1;34m'), | ||
LIGHT_PURPLE: getColor('\x1b[1;35m'), | ||
LIGHT_CYAN: getColor('\x1b[1;36m'), | ||
WHITE: getColor('\x1b[1;37m'), | ||
} | ||
|
||
const getTime = (format = DATETIME_FORMAT, utc = false): string => { | ||
return dateFormat(Date.now(), format, utc) | ||
} | ||
|
||
export const toLog = (message: string, ...args: any[]): void => { | ||
console.group('>>>') | ||
console.log(`${COLORS.PURPLE}${getTime()}:${COLORS.RESET}`, message, ...args) | ||
console.groupEnd() | ||
} | ||
|
||
export const createLogger = <T>(logger: Logger<T, any>, processor?: Processor<T, T>): Logger<T, any> => { | ||
return (message, ...args) => { | ||
logger(processor ? processor(message) : message, ...args) | ||
} | ||
} | ||
|
||
export const logs = createLogger((message, ...args) => | ||
console.log(`${COLORS.PURPLE}${getTime()}:${COLORS.RESET}`, message, args) | ||
) | ||
export const errorLogs = createLogger((message, ...args) => | ||
console.error(`${COLORS.RED}${getTime()}:${COLORS.RESET}`, message, args) | ||
) | ||
export const warnLogs = createLogger((message, ...args) => | ||
console.warn(`${COLORS.GREEN}${getTime()}:${COLORS.RESET}`, message, args) | ||
) | ||
export const debugLogs = createLogger((message, ...args) => | ||
console.debug(`${COLORS.BLUE}${getTime()}:${COLORS.RESET}`, message, args) | ||
) | ||
export const traceLogs = createLogger((message, ...args) => | ||
console.trace(`${COLORS.CYAN}${getTime()}:${COLORS.RESET}`, message, args) | ||
) | ||
|
||
export const boxenLogs = createLogger(console.log, message => boxen(message, profile.outputOptions)) | ||
|
||
export const boxenErrorLogs = createLogger(console.error, message => | ||
boxen( | ||
message, | ||
mergeProps(profile.outputOptions, { | ||
borderColor: 'red', | ||
borderStyle: 'double', | ||
}) | ||
) | ||
) | ||
export const boxenWarnLogs = createLogger(console.warn, message => | ||
boxen(message, mergeProps(profile.outputOptions, { borderColor: 'green' })) | ||
) | ||
export const boxenDebugLogs = createLogger(console.debug, message => | ||
boxen(message, mergeProps(profile.outputOptions, { borderColor: 'blue' })) | ||
) | ||
export const boxenTraceLogs = createLogger(console.trace, message => | ||
boxen(message, mergeProps(profile.outputOptions, { borderColor: 'cyan' })) | ||
) | ||
|
||
export const coreInfo = createLogger(core.info, message => boxen(message, profile.outputOptions)) | ||
|
||
export const coreError = createLogger(core.error, message => boxen(message.toString(), profile.outputOptions)) | ||
|
||
export const logArrayElements = <T>(index: number, array: T[]): void => { | ||
logs(`array[${index}] = ${array[index]}`) | ||
} | ||
|
||
export const dumpObject = (obj: any): string => { | ||
let out = '' | ||
if (obj && typeof obj === 'object') { | ||
for (const i in obj) { | ||
if (Object.prototype.hasOwnProperty.call(obj, i)) { | ||
out += `${i}: ${obj[i]}n` | ||
} | ||
} | ||
} else { | ||
out = obj | ||
} | ||
|
||
return out | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters