feat: create action-conventional-commits

This commit is contained in:
Adrian Smijulj 2020-06-11 08:42:06 +02:00
parent 7bb041923b
commit b3b8bc11c1
2 changed files with 26 additions and 8 deletions

16
dist/main/index.js vendored
View file

@ -23572,13 +23572,23 @@ function run() {
core.info(`No commits to check, skipping...`);
return;
}
let hasErrors;
for (let i = 0; i < context.payload.commits.length; i++) {
let commit = context.payload.commits[i];
if (!isValidCommitMessage(commit.message)) {
core.setFailed(`According to the conventional-commits specification, commit message ${commit.message} is not valid.`);
if (isValidCommitMessage(commit.message)) {
core.info(`${commit.message}`);
}
else {
core.info(`🚩 ${commit.message}`);
hasErrors = true;
}
}
core.info("🎉 All commit messages are following the Conventional Commits specification.");
if (hasErrors) {
core.setFailed(`🚫 According to the conventional-commits specification, some of the commit messages are not valid.`);
}
else {
core.info("🎉 All commit messages are following the Conventional Commits specification.");
}
});
}
run();

18
main.ts
View file

@ -14,16 +14,24 @@ async function run() {
return;
}
let hasErrors;
for (let i = 0; i < context.payload.commits.length; i++) {
let commit = context.payload.commits[i];
if (!isValidCommitMessage(commit.message)) {
core.setFailed(
`According to the conventional-commits specification, commit message ${commit.message} is not valid.`
);
if (isValidCommitMessage(commit.message)) {
core.info(`${commit.message}`);
} else {
core.info(`🚩 ${commit.message}`);
hasErrors = true;
}
}
core.info("🎉 All commit messages are following the Conventional Commits specification.");
if (hasErrors) {
core.setFailed(
`🚫 According to the conventional-commits specification, some of the commit messages are not valid.`
);
} else {
core.info("🎉 All commit messages are following the Conventional Commits specification.");
}
}
run();