@@ -5300,7 +5300,7 @@ module.exports = function(fn) {
53005300/***/ 557:
53015301/***/ (function(__unusedmodule, __unusedexports, __webpack_require__) {
53025302
5303- const { getInput, setFailed, debug } = __webpack_require__(674);
5303+ const { getInput, setFailed, debug, error } = __webpack_require__(674);
53045304const { GitHub, context } = __webpack_require__(205);
53055305
53065306const { BAD_KEYWORDS, MIN_COMMIT_MESSAGE_LENGTH } = __webpack_require__(481);
@@ -5319,29 +5319,37 @@ function filterCommit(commit) {
53195319
53205320async function verifyCommits(repoToken) {
53215321 const client = new GitHub(repoToken);
5322- const { data: commits } = client.pulls.listCommits({ owner: context.repo.repo , repo: context.repo.repo, pull_number: context.issue.number})
5323- debug(`There are ${commits.length} commits`);
5322+ const { data: commits } = await client.pulls.listCommits({ owner: context.repo.owner , repo: context.repo.repo, pull_number: context.issue.number})
5323+ debug(`There are ${commits.length} commits in this pr `);
53245324
5325- let errors = [];
5325+ let badCommits = 0;
5326+ let isCommitBad = false;
53265327 for (const commit of commits) {
53275328 const { message } = commit.commit;
5328- debug(message);
53295329
53305330 if (message.length < MIN_COMMIT_MESSAGE_LENGTH) {
5331- errors.push(`${message} has less than ${MIN_COMMIT_MESSAGE_LENGTH} characters`);
5331+ error(`commit message \"${message}\" has less than ${MIN_COMMIT_MESSAGE_LENGTH} characters`);
5332+ isCommitBad = true;
53325333 }
53335334
53345335 if (message[0] !== message[0].toUpperCase()) {
5335- errors.push(`${message} should have first letter in upper case`);
5336+ error(`commit message \"${message}\" should have first letter in upper case`);
5337+ isCommitBad = true;
53365338 }
53375339
53385340 const badKeywords = filterCommit(message);
53395341 if (badKeywords.length) {
5340- errors.push(`${message} contains ${badKeywords.join()}`);
5342+ error(`commit message \"${message}\" contains ${badKeywords.join()}`);
5343+ isCommitBad = true;
5344+ }
5345+
5346+ if(isCommitBad) {
5347+ badCommits++;
5348+ isCommitBad = false;
53415349 }
53425350 }
5343- if (errors.length ) {
5344- throw Error(errors);
5351+ if (badCommits ) {
5352+ throw Error(`${badCommits} have been encountered. Please fix the above errors` );
53455353 }
53465354}
53475355async function main() {
0 commit comments