2019-06-05 10:23:58 +02:00
|
|
|
import { danger, fail, warn } from "danger";
|
2018-01-25 16:24:05 +01:00
|
|
|
|
2018-01-25 19:51:23 +01:00
|
|
|
// Check if the CHANGELOG.md file has been edited
|
|
|
|
// Fail the build and post a comment reminding submitters to do so if it wasn't changed
|
2018-01-26 12:12:44 +01:00
|
|
|
if (!danger.git.modified_files.includes("CHANGELOG.md")) {
|
2019-06-05 10:23:58 +02:00
|
|
|
warn("Please include an updated `CHANGELOG.md` file.<br>This way we can keep track of all the contributions.");
|
2018-01-26 12:12:44 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
// Check if the PR request is send to the master branch.
|
|
|
|
// This should only be done by MichMich.
|
|
|
|
if (danger.github.pr.base.ref === "master" && danger.github.pr.user.login !== "MichMich") {
|
|
|
|
// Check if the PR body or title includes the text: #accepted.
|
|
|
|
// If not, the PR will fail.
|
|
|
|
if ((danger.github.pr.body + danger.github.pr.title).includes("#accepted")) {
|
2019-06-05 10:23:58 +02:00
|
|
|
fail("Please send all your pull requests to the `develop` branch.<br>Pull requests on the `master` branch will not be accepted.");
|
2018-01-26 12:12:44 +01:00
|
|
|
}
|
2019-06-05 10:23:58 +02:00
|
|
|
}
|