mirror of
https://github.com/webiny/action-conventional-commits.git
synced 2024-11-23 10:21:51 +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
16
dist/main/index.js
vendored
16
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;
|
||||
}
|
||||
}
|
||||
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
18
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;
|
||||
}
|
||||
}
|
||||
|
||||
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();
|
||||
|
|
Loading…
Reference in a new issue