@octorelease/core
Advanced tools
Comparing version 0.1.2 to 0.1.3
@@ -25,2 +25,6 @@ /** | ||
/** | ||
* Specify whether to detect [ci skip] in last commit message | ||
*/ | ||
static get ciSkip(): boolean; | ||
/** | ||
* Custom directory to search for release configuration. | ||
@@ -27,0 +31,0 @@ */ |
@@ -48,2 +48,16 @@ "use strict"; | ||
/** | ||
* Specify whether to detect [ci skip] in last commit message | ||
*/ | ||
static get ciSkip() { | ||
try { | ||
return core.getBooleanInput("ci-skip"); | ||
} | ||
catch (error) { | ||
if (error instanceof TypeError) { | ||
return true; | ||
} | ||
throw error; | ||
} | ||
} | ||
/** | ||
* Custom directory to search for release configuration. | ||
@@ -50,0 +64,0 @@ */ |
@@ -20,4 +20,3 @@ /** | ||
export declare class Logger { | ||
private pluginName?; | ||
constructor(pluginName?: string | undefined); | ||
constructor(pluginName?: string); | ||
/** | ||
@@ -24,0 +23,0 @@ * Output debug level message with plugin name prepended. |
@@ -53,2 +53,3 @@ #!/usr/bin/env node | ||
function run() { | ||
var _a; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
@@ -64,2 +65,6 @@ try { | ||
} | ||
else if (inputs_1.Inputs.ciSkip && ((_a = (yield utils.getLastCommitMessage())) === null || _a === void 0 ? void 0 : _a.includes("[ci skip]"))) { | ||
core.info("Commit message contains CI skip phrase, exiting now"); | ||
process.exit(); | ||
} | ||
const pluginsLoaded = yield utils.loadPlugins(context); | ||
@@ -66,0 +71,0 @@ try { |
@@ -49,3 +49,2 @@ "use strict"; | ||
const inputs_1 = require("./inputs"); | ||
const logger_1 = require("./logger"); | ||
/** | ||
@@ -64,3 +63,9 @@ * Run "fail" stage for loaded plugins that have a "fail" handler. | ||
context.logger.info(`Running "fail" stage for plugin ${pluginName}`); | ||
yield pluginModule.fail(Object.assign(Object.assign({}, context), { logger: new logger_1.Logger(pluginName) }), context.plugins[pluginName] || {}); | ||
context.logger.pluginName = pluginName; | ||
try { | ||
yield pluginModule.fail(context, context.plugins[pluginName] || {}); | ||
} | ||
finally { | ||
context.logger.pluginName = undefined; | ||
} | ||
} | ||
@@ -82,3 +87,9 @@ } | ||
context.logger.info(`Running "init" stage for plugin ${pluginName}`); | ||
yield pluginModule.init(Object.assign(Object.assign({}, context), { logger: new logger_1.Logger(pluginName) }), context.plugins[pluginName] || {}); | ||
context.logger.pluginName = pluginName; | ||
try { | ||
yield pluginModule.init(context, context.plugins[pluginName] || {}); | ||
} | ||
finally { | ||
context.logger.pluginName = undefined; | ||
} | ||
} | ||
@@ -102,3 +113,9 @@ } | ||
context.logger.info(`Running "publish" stage for plugin ${pluginName}`); | ||
yield pluginModule.publish(Object.assign(Object.assign({}, context), { logger: new logger_1.Logger(pluginName) }), context.plugins[pluginName] || {}); | ||
context.logger.pluginName = pluginName; | ||
try { | ||
yield pluginModule.publish(context, context.plugins[pluginName] || {}); | ||
} | ||
finally { | ||
context.logger.pluginName = undefined; | ||
} | ||
} | ||
@@ -122,3 +139,9 @@ } | ||
context.logger.info(`Running "success" stage for plugin ${pluginName}`); | ||
yield pluginModule.success(Object.assign(Object.assign({}, context), { logger: new logger_1.Logger(pluginName) }), context.plugins[pluginName] || {}); | ||
context.logger.pluginName = pluginName; | ||
try { | ||
yield pluginModule.success(context, context.plugins[pluginName] || {}); | ||
} | ||
finally { | ||
context.logger.pluginName = undefined; | ||
} | ||
} | ||
@@ -142,3 +165,9 @@ } | ||
context.logger.info(`Running "version" stage for plugin ${pluginName}`); | ||
yield pluginModule.version(Object.assign(Object.assign({}, context), { logger: new logger_1.Logger(pluginName) }), context.plugins[pluginName] || {}); | ||
context.logger.pluginName = pluginName; | ||
try { | ||
yield pluginModule.version(context, context.plugins[pluginName] || {}); | ||
} | ||
finally { | ||
context.logger.pluginName = undefined; | ||
} | ||
} | ||
@@ -145,0 +174,0 @@ } |
@@ -47,1 +47,6 @@ /** | ||
export declare function verifyConditions(context: IContext): Promise<void>; | ||
/** | ||
* Retrieve most recent Git commit message if there is one. | ||
* @returns Commit message or undefined if there is no Git history | ||
*/ | ||
export declare function getLastCommitMessage(): Promise<string | undefined>; |
@@ -46,3 +46,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.verifyConditions = exports.loadPlugins = exports.dryRunTask = exports.buildContext = void 0; | ||
exports.getLastCommitMessage = exports.verifyConditions = exports.loadPlugins = exports.dryRunTask = exports.buildContext = void 0; | ||
const fs = __importStar(require("fs")); | ||
@@ -72,4 +72,7 @@ const path = __importStar(require("path")); | ||
} | ||
else if (branchIndex > 0 && branches[branchIndex].channel == null) { | ||
branches[branchIndex].channel = branches[branchIndex].name; | ||
else { | ||
branches[branchIndex].name = envCi.branch; | ||
if (branchIndex > 0 && branches[branchIndex].channel == null) { | ||
branches[branchIndex].channel = branches[branchIndex].name; | ||
} | ||
} | ||
@@ -88,3 +91,3 @@ const pluginConfig = {}; | ||
return { | ||
branch: Object.assign(Object.assign({}, branches[branchIndex]), { name: envCi.branch }), | ||
branch: branches[branchIndex], | ||
changedFiles: [], | ||
@@ -185,2 +188,13 @@ ci: envCi, | ||
/** | ||
* Retrieve most recent Git commit message if there is one. | ||
* @returns Commit message or undefined if there is no Git history | ||
*/ | ||
function getLastCommitMessage() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const cmdOutput = yield exec.getExecOutput("git", ["log", "-1", "--pretty=format:%s"], { ignoreReturnCode: true }); | ||
return cmdOutput.exitCode === 0 && cmdOutput.stdout.trim() || undefined; | ||
}); | ||
} | ||
exports.getLastCommitMessage = getLastCommitMessage; | ||
/** | ||
* Load CI properties like branch name, commit SHA, and repository slug. | ||
@@ -187,0 +201,0 @@ * @returns CI environment for the `context.ci` property |
{ | ||
"name": "@octorelease/core", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"description": "Octorelease core package containing the CLI and APIs for plugins.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
59472
1444