diff --git a/bin/legacy/deprecation.js b/bin/legacy/deprecation.js index 0a5605a9aa..1b57bb937a 100644 --- a/bin/legacy/deprecation.js +++ b/bin/legacy/deprecation.js @@ -1,9 +1,19 @@ const winston = require('winston'); -// deprecationNotice adds middleware to the yargs chain to display a deprecation notice. -const deprecationNotice = (opts = {}) => { +// addDeprecationNotice adds middleware to the yargs chain to display a deprecation notice. +const addDeprecationNotice = (opts = {}) => { const { builder, notice } = opts; - return (yargs) => builder(yargs).middleware([(argv) => winston.warn(notice)]); + return (yargs) => + builder(yargs).middleware([(opts) => deprecationNotice(opts, notice)]); }; -exports.deprecationNotice = deprecationNotice; +const deprecationNotice = (opts, notice) => { + const { cml } = opts; + if (cml.driver.warn) { + cml.driver.warn(notice); + } else { + winston.warn(notice); + } +}; + +exports.addDeprecationNotice = addDeprecationNotice; diff --git a/src/drivers/github.js b/src/drivers/github.js index 5362f59e5e..dee44a5422 100644 --- a/src/drivers/github.js +++ b/src/drivers/github.js @@ -701,6 +701,10 @@ class Github { return command; } + warn(message) { + console.log(`::warning::${message}`); + } + get sha() { if (GITHUB_EVENT_NAME === 'pull_request') return github.context.payload.pull_request.head.sha;