2023-09-22 04:35:24 -04:00
|
|
|
const { displayAllOutputStatuses } = require("./configParameters.js");
|
|
|
|
|
2023-02-21 02:56:09 -05:00
|
|
|
/*
|
|
|
|
* Modules with checks are stored in ".gitlab/dangerjs/<module_name>". To import them, use path relative to "dangerfile.js"
|
|
|
|
*/
|
|
|
|
async function runChecks() {
|
|
|
|
// Checks for merge request title
|
|
|
|
require("./mrTitleNoDraftOrWip.js")();
|
|
|
|
|
|
|
|
// Checks for merge request description
|
|
|
|
require("./mrDescriptionLongEnough.js")();
|
2023-08-02 14:17:57 -04:00
|
|
|
require("./mrDescriptionReleaseNotes.js")();
|
2023-03-20 09:01:14 -04:00
|
|
|
await require("./mrDescriptionJiraLinks.js")();
|
2023-02-21 02:56:09 -05:00
|
|
|
|
|
|
|
// Checks for documentation
|
2023-03-08 08:45:44 -05:00
|
|
|
await require("./mrDocsTranslation.js")();
|
2023-02-21 02:56:09 -05:00
|
|
|
|
|
|
|
// Checks for MR commits
|
|
|
|
require("./mrCommitsTooManyCommits.js")();
|
2023-03-30 05:16:39 -04:00
|
|
|
await require("./mrCommitsCommitMessage.js")();
|
2023-03-07 18:02:37 -05:00
|
|
|
require("./mrCommitsEmail.js")();
|
2023-02-21 02:56:09 -05:00
|
|
|
|
|
|
|
// Checks for MR code
|
|
|
|
require("./mrSizeTooLarge.js")();
|
|
|
|
|
2023-03-20 09:01:14 -04:00
|
|
|
// Checks for MR area labels
|
|
|
|
await require("./mrAreaLabels.js")();
|
|
|
|
|
2023-09-20 00:32:47 -04:00
|
|
|
// Checks for Source branch name
|
|
|
|
require("./mrSourceBranchName.js")();
|
|
|
|
|
2023-09-22 04:35:24 -04:00
|
|
|
// Show DangerJS individual checks statuses - visible in CI job tracelog
|
|
|
|
displayAllOutputStatuses();
|
|
|
|
|
2023-02-21 02:56:09 -05:00
|
|
|
// Add success log if no issues
|
|
|
|
if (
|
|
|
|
results.fails.length === 0 &&
|
|
|
|
results.warnings.length === 0 &&
|
|
|
|
results.messages.length === 0
|
|
|
|
) {
|
2023-09-22 04:35:24 -04:00
|
|
|
return message("🎉 Good Job! All checks are passing!");
|
2023-02-21 02:56:09 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
runChecks();
|
|
|
|
|
|
|
|
// Add retry link
|
|
|
|
const retryLink = `${process.env.DANGER_GITLAB_HOST}/${process.env.CI_PROJECT_PATH}/-/jobs/${process.env.CI_JOB_ID}`;
|
|
|
|
markdown(
|
|
|
|
`***\n#### :repeat: You can enforce automatic MR checks by retrying the [DangerJS job](${retryLink})\n***`
|
|
|
|
);
|