Skip to content

Commit 16208bc

Browse files
committed
bump: release
1 parent d9d62d8 commit 16208bc

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

dist/index.js

+6-5
Original file line numberDiff line numberDiff line change
@@ -80,21 +80,22 @@ async function checkCommitMessages(args) {
8080
// Check messages
8181
let result = true;
8282
core.info(`Checking commit messages against "${args.pattern}"...`);
83+
let debugRegexMsg = '';
8384
for (const message of args.messages) {
8485
if (checkMessage(message, args.pattern, args.flags)) {
8586
core.info(`- OK: "${message}"`);
8687
}
8788
else {
8889
core.info(`- failed: "${message}"`);
8990
if (args.debugRegex !== null) {
90-
core.info(debugRegexMatching(args.debugRegex, message));
91+
debugRegexMsg = '\n' + debugRegexMatching(args.debugRegex, message);
9192
}
9293
result = false;
9394
}
9495
}
9596
// Throw error in case of failed test
9697
if (!result) {
97-
throw new Error(args.error);
98+
throw new Error(args.error + debugRegexMsg);
9899
}
99100
}
100101
exports.checkCommitMessages = checkCommitMessages;
@@ -152,13 +153,13 @@ const debugRegexMatching = (regexes, str) => {
152153
return `Trailing characters: "${str}"
153154
--------------------------------
154155
Context: "${leftDots}${copyStr.slice(paddingLeft, Math.min(copyStr.length, matchesUntil + 10)).replaceAll('\n', '␤')}${rightDots}"
155-
${" ".repeat(matchesUntil - paddingLeft)}^`;
156+
${' '.repeat(leftDots.length)}${" ".repeat(matchesUntil - paddingLeft)}^`;
156157
}
157158
else {
158159
return `The regex stopped matching at index: ${matchesUntil}.
159-
Expected: "${rgx}"
160+
Expected: ${rgx}
160161
Context: "${leftDots}${copyStr.slice(paddingLeft, paddingRight).replaceAll('\n', '␤')}${rightDots}"
161-
${" ".repeat(matchesUntil - paddingLeft)}^${"~".repeat(paddingRight - matchesUntil)}`;
162+
${' '.repeat(leftDots.length)}${" ".repeat(matchesUntil - paddingLeft)}^${"~".repeat(paddingRight - matchesUntil)}`;
162163
}
163164
}
164165
};

0 commit comments

Comments
 (0)