Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: github actions logging #752

Merged
merged 6 commits into from Jul 19, 2022
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
33 changes: 33 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Expand Up @@ -35,6 +35,7 @@
"node": ">= 14"
},
"dependencies": {
"@actions/core": "^1.9.0",
"azure-devops-node-api": "^11.0.1",
"chalk": "^2.4.2",
"cheerio": "^1.0.0-rc.9",
Expand Down
7 changes: 4 additions & 3 deletions src/util.ts
Expand Up @@ -6,6 +6,7 @@ import chalk from 'chalk';
import { PublicGalleryAPI } from './publicgalleryapi';
import { ISecurityRolesApi } from 'azure-devops-node-api/SecurityRolesApi';
import { Manifest } from './manifest';
import { error, info, warning } from '@actions/core';

const __read = promisify<_read.Options, string>(_read);
export function read(prompt: string, options: _read.Options = {}): Promise<string> {
Expand Down Expand Up @@ -129,11 +130,11 @@ function _log(type: LogMessageType, msg: any, ...args: any[]): void {
args = [LogPrefix[type], msg, ...args];

if (type === LogMessageType.WARNING) {
console.warn(...args);
process.env['GITHUB_ACTIONS'] ? warning(msg) : console.warn(...args);
} else if (type === LogMessageType.ERROR) {
console.error(...args);
process.env['GITHUB_ACTIONS'] ? error(msg) : console.error(...args);
} else {
console.log(...args);
process.env['GITHUB_ACTIONS'] ? info(msg) : console.log(...args);
}
}

Expand Down