mirror of
https://github.com/webiny/action-conventional-commits.git
synced 2024-11-27 04:03:49 +01:00
feat: create action-conventional-commits
This commit is contained in:
parent
7bb041923b
commit
b3b8bc11c1
2 changed files with 26 additions and 8 deletions
14
dist/main/index.js
vendored
14
dist/main/index.js
vendored
|
@ -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;
|
||||
}
|
||||
}
|
||||
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();
|
||||
|
|
16
main.ts
16
main.ts
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue