@@ -15,9 +15,9 @@ var Status;
1515 Status["Ok"] = "Correct";
1616})(Status || (exports.Status = Status = {}));
1717class Result {
18- constructor(status, message = '' , commit = undefined) {
18+ constructor(status, message = "" , commit = undefined) {
1919 this.status = Status.Failure;
20- this.message = '' ;
20+ this.message = "" ;
2121 this.commit = undefined;
2222 this.status = status;
2323 this.message = message;
@@ -41,9 +41,9 @@ class Result {
4141 if (this.commit !== undefined) {
4242 msg += ` | ${this.commit.hexsha} - ${this.commit.summary()}`;
4343 }
44- if (this.message !== '' ) {
44+ if (this.message !== "" ) {
4545 if (this.commit === undefined) {
46- msg += ' |' ;
46+ msg += " |" ;
4747 }
4848 msg += `\n : ${this.message}`;
4949 }
@@ -56,9 +56,9 @@ class CommitValidator {
5656 this.options = options;
5757 }
5858 static split_message(message) {
59- const res = message.split('\n' , 1);
59+ const res = message.split("\n" , 1);
6060 if (res.length === 1) {
61- return [res[0], '' ];
61+ return [res[0], "" ];
6262 }
6363 return [res[0], res[1]];
6464 }
@@ -73,7 +73,7 @@ class CommitValidator {
7373 return check;
7474 }
7575 validate_message(_summary, _description) {
76- return new Result(Status.Ok, '' );
76+ return new Result(Status.Ok, "" );
7777 }
7878}
7979exports.CommitValidator = CommitValidator;
@@ -93,9 +93,9 @@ class User {
9393 this.email = undefined;
9494 this.name = undefined;
9595 this.username = undefined;
96- this.email = data[' email' ];
97- this.name = data[' name' ];
98- this.username = data[' username' ];
96+ this.email = data[" email" ];
97+ this.name = data[" name" ];
98+ this.username = data[" username" ];
9999 }
100100}
101101exports.User = User;
@@ -108,22 +108,22 @@ class Commit {
108108 this.hexsha = undefined;
109109 this.timestamp = undefined;
110110 this.message = undefined;
111- this.author = new User(commit[' author' ]);
112- this.committer = new User(commit[' committer' ]);
113- this.distinct = (_a = commit[' distinct' ]) !== null && _a !== void 0 ? _a : false;
114- this.hexsha = (_b = commit['id' ]) !== null && _b !== void 0 ? _b : sha;
115- const timestamp_raw = (_c = commit[' timestamp' ]) !== null && _c !== void 0 ? _c : timestamp;
111+ this.author = new User(commit[" author" ]);
112+ this.committer = new User(commit[" committer" ]);
113+ this.distinct = (_a = commit[" distinct" ]) !== null && _a !== void 0 ? _a : false;
114+ this.hexsha = (_b = commit["id" ]) !== null && _b !== void 0 ? _b : sha;
115+ const timestamp_raw = (_c = commit[" timestamp" ]) !== null && _c !== void 0 ? _c : timestamp;
116116 if (timestamp_raw !== undefined) {
117117 this.timestamp = new Date(timestamp_raw);
118118 }
119- this.message = commit[' message' ];
119+ this.message = commit[" message" ];
120120 }
121121 // return empty string if message is undefined
122122 summary() {
123123 if (this.message === undefined) {
124- return '' ;
124+ return "" ;
125125 }
126- return this.message.split('\n' , 1)[0];
126+ return this.message.split("\n" , 1)[0];
127127 }
128128}
129129exports.Commit = Commit;
@@ -188,7 +188,7 @@ function download_validator_file(validator_file, octokit) {
188188 path: validator_file,
189189 owner: github.context.repo.owner,
190190 repo: github.context.repo.repo,
191- ref: github.context.sha,
191+ ref: github.context.sha
192192 });
193193 if (response.status !== 200) {
194194 core.error(JSON.stringify(response.data));
@@ -203,7 +203,7 @@ function download_validator_file(validator_file, octokit) {
203203 core.setFailed(`download of '${response.url}' failed`);
204204 return ["", ""];
205205 }
206- const buffer = Buffer.from(response.data.content, ' base64' ).toString(' utf-8' );
206+ const buffer = Buffer.from(response.data.content, " base64" ).toString(" utf-8" );
207207 const output_path = (0, url_1.pathToFileURL)((0, path_1.resolve)("./validator.mjs"));
208208 fs_1.default.writeFileSync(output_path, buffer);
209209 return [response.data.html_url || "", output_path.toString()];
@@ -213,10 +213,10 @@ exports.download_validator_file = download_validator_file;
213213function get_commit_creation(octokit) {
214214 var _a;
215215 return __awaiter(this, void 0, void 0, function* () {
216- const response = yield octokit.request(' GET /repos/{owner}/{repo}/git/commits/{commit_sha}' , {
216+ const response = yield octokit.request(" GET /repos/{owner}/{repo}/git/commits/{commit_sha}" , {
217217 owner: github.context.repo.owner,
218218 repo: github.context.repo.repo,
219- commit_sha: (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.base.sha,
219+ commit_sha: (_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.base.sha
220220 });
221221 if (response.status !== 200) {
222222 core.error(JSON.stringify(response.data));
@@ -234,16 +234,16 @@ function get_commits(octokit) {
234234 return __awaiter(this, void 0, void 0, function* () {
235235 const commits = [];
236236 switch (github.context.eventName) {
237- case ' pull_request' : {
237+ case " pull_request" : {
238238 const pages = Math.floor(((_a = github.context.payload.pull_request) === null || _a === void 0 ? void 0 : _a.commits) / 100) + 1;
239239 for (let page = 1; page <= pages; page++) {
240- const response = yield octokit.request(' GET /repos/{owner}/{repo}/commits' , {
240+ const response = yield octokit.request(" GET /repos/{owner}/{repo}/commits" , {
241241 owner: (_b = github.context.payload.pull_request) === null || _b === void 0 ? void 0 : _b.head.repo.owner.login,
242242 repo: (_c = github.context.payload.pull_request) === null || _c === void 0 ? void 0 : _c.head.repo.name,
243243 sha: (_d = github.context.payload.pull_request) === null || _d === void 0 ? void 0 : _d.head.ref,
244244 since: yield get_commit_creation(octokit),
245245 per_page: 100,
246- page,
246+ page
247247 });
248248 if (response.status !== 200) {
249249 core.error(JSON.stringify(response.data));
@@ -259,16 +259,16 @@ function get_commits(octokit) {
259259 }
260260 break;
261261 }
262- case ' push' :
262+ case " push" :
263263 default: {
264- if (' commits' in github.context.payload && github.context.payload[' commits' ].length > 0) {
265- for (const commit of github.context.payload[' commits' ]) {
264+ if (" commits" in github.context.payload && github.context.payload[" commits" ].length > 0) {
265+ for (const commit of github.context.payload[" commits" ]) {
266266 commits.push(new commit_1.Commit(commit));
267267 }
268268 // on tags or if commits was empty
269269 }
270- else if (' head_commit' in github.context.payload) {
271- commits.push(new commit_1.Commit(github.context.payload[' head_commit' ]));
270+ else if (" head_commit" in github.context.payload) {
271+ commits.push(new commit_1.Commit(github.context.payload[" head_commit" ]));
272272 }
273273 }
274274 }
@@ -349,18 +349,18 @@ const gh_utils = __importStar(__nccwpck_require__(8642));
349349function run() {
350350 return __awaiter(this, void 0, void 0, function* () {
351351 try {
352- const validator_file = core.getInput(' validator_file' );
353- const validator_name = core.getInput(' validator' );
354- const options = core.getMultilineInput(' options' );
355- const access_token = core.getInput(' access_token' );
352+ const validator_file = core.getInput(" validator_file" );
353+ const validator_name = core.getInput(" validator" );
354+ const options = core.getMultilineInput(" options" );
355+ const access_token = core.getInput(" access_token" );
356356 // just to be sure
357357 core.setSecret(access_token);
358358 core.debug(JSON.stringify(github.context));
359- if (validator_file !== '' && validator_name !== '' ) {
359+ if (validator_file !== "" && validator_name !== "" ) {
360360 core.setFailed("Please provide only 'validator' or 'validator_file'!");
361361 return;
362362 }
363- if (validator_file === '' && validator_name === '' ) {
363+ if (validator_file === "" && validator_name === "" ) {
364364 core.setFailed("Please provide either 'validator' or 'validator_file'!");
365365 return;
366366 }
@@ -442,17 +442,17 @@ const validation = __importStar(__nccwpck_require__(581));
442442function get_shipped_validator_cls(validator) {
443443 return __awaiter(this, void 0, void 0, function* () {
444444 switch (validator.toLowerCase()) {
445- case ' simpletag' :
445+ case " simpletag" :
446446 return validation.SimpleTag;
447- case ' regex' :
447+ case " regex" :
448448 return validation.RegEx;
449449 default:
450- throw Error(' Invalid validator name!' );
450+ throw Error(" Invalid validator name!" );
451451 }
452452 });
453453}
454454exports.get_shipped_validator_cls = get_shipped_validator_cls;
455- const _importDynamic = new Function(' modulePath', ' return import(modulePath)' );
455+ const _importDynamic = new Function(" modulePath", " return import(modulePath)" );
456456function import_validator_cls(validator_file) {
457457 return __awaiter(this, void 0, void 0, function* () {
458458 const validation_mod = yield _importDynamic(validator_file);
@@ -489,23 +489,23 @@ class SimpleTag extends commit_validator_1.CommitValidator {
489489 validate_message(summary, _description) {
490490 const match = SimpleTag.rx_parser.exec(summary);
491491 if (match === null) {
492- return new commit_validator_1.Result(commit_validator_1.Status.Failure, ' Summary has invalid format. It should be \ '[<tag>] <Good Description>\'' );
492+ return new commit_validator_1.Result(commit_validator_1.Status.Failure, " Summary has invalid format. It should be '[<tag>] <Good Description>'" );
493493 }
494494 if (!SimpleTag.rx_category.test(match[1])) {
495495 return new commit_validator_1.Result(commit_validator_1.Status.Failure, "Invalid category tag. It should be either a single '*' or completely lowercase " +
496496 "letters or numbers, at least 2 characters long, other allowed characters are: '|', '-' and spaces.");
497497 }
498498 if (!SimpleTag.rx_description.test(match[2])) {
499- return new commit_validator_1.Result(commit_validator_1.Status.Failure, ' Invalid description. It should start with an uppercase letter or number, ' +
500- ' should be not to short and should not end with a punctuation.' );
499+ return new commit_validator_1.Result(commit_validator_1.Status.Failure, " Invalid description. It should start with an uppercase letter or number, " +
500+ " should be not to short and should not end with a punctuation." );
501501 }
502502 return new commit_validator_1.Result(commit_validator_1.Status.Ok);
503503 }
504504}
505505exports.SimpleTag = SimpleTag;
506- SimpleTag.rx_parser = new RegExp(' ^\\[(.*)] (.*)$' );
507- SimpleTag.rx_category = new RegExp(' ^\\*|(?:[a-z0-9]{2,}[ |-]?)+$' );
508- SimpleTag.rx_description = new RegExp(' ^[A-Z0-9]\\S*(?:\\s\\S*)+[^.!?,\\s]$' );
506+ SimpleTag.rx_parser = new RegExp(" ^\\[(.*)] (.*)$" );
507+ SimpleTag.rx_category = new RegExp(" ^\\*|(?:[a-z0-9]{2,}[ |-]?)+$" );
508+ SimpleTag.rx_description = new RegExp(" ^[A-Z0-9]\\S*(?:\\s\\S*)+[^.!?,\\s]$" );
509509class RegEx extends commit_validator_1.CommitValidator {
510510 constructor(options) {
511511 super(options);
0 commit comments