diff --git a/lib/format-commit-message.js b/lib/format-commit-message.js index 06b8702fe..b79ad2eb3 100644 --- a/lib/format-commit-message.js +++ b/lib/format-commit-message.js @@ -1,5 +1,10 @@ const util = require('util') -module.exports = function (msg, newVersion) { - return String(msg).indexOf('%s') !== -1 ? util.format(msg, newVersion) : msg +module.exports = function (rawMsg, newVersion) { + const message = String(rawMsg) + const matchCount = (message.match(/%s/g) || []).length + const args = Array(1 + matchCount) + args[0] = message + args.fill(newVersion, 1, args.length) + return util.format.apply(util, args) }