Danger markdown message & todo comments (#2698)
- markdown message & todo comments
This commit is contained in:
@ -1,30 +1,45 @@
|
||||
import {message, danger, warn} from "danger"
|
||||
|
||||
import { danger, warn, markdown, schedule } from "danger";
|
||||
import todos from "danger-plugin-todos";
|
||||
|
||||
function getMdSection(category: string, message: string) {
|
||||
return `# ${category} <br>${message}`;
|
||||
}
|
||||
|
||||
// Check if package.json was changed, but not yarn.lock
|
||||
const packageChanged = danger.git.modified_files.includes('package.json');
|
||||
const lockfileChanged = danger.git.modified_files.includes('yarn.lock');
|
||||
const packageChanged = danger.git.modified_files.includes("package.json");
|
||||
const lockfileChanged = danger.git.modified_files.includes("yarn.lock");
|
||||
if (packageChanged && !lockfileChanged) {
|
||||
const message = 'Changes were made to package.json, but not to yarn.lock';
|
||||
const idea = 'Perhaps you need to run `yarn install`?';
|
||||
const message = "Changes were made to package.json, but not to yarn.lock";
|
||||
const idea = "Perhaps you need to run `yarn install`?";
|
||||
warn(`${message} - <i>${idea}</i>`);
|
||||
}
|
||||
|
||||
// Check if .env.example was changed, but not enviroment variable documentation
|
||||
const envChanged = danger.git.modified_files.includes('.env.example') || danger.git.modified_files.includes('environment.service.ts');
|
||||
const envDocsChanged = danger.git.modified_files.includes('enviroment-variables.mdx');
|
||||
const envChanged =
|
||||
danger.git.modified_files.includes(".env.example") ||
|
||||
danger.git.modified_files.includes("environment.service.ts");
|
||||
const envDocsChanged = danger.git.modified_files.includes(
|
||||
"enviroment-variables.mdx"
|
||||
);
|
||||
if (envChanged && !envDocsChanged) {
|
||||
const message = 'Changes were made to the enviroment variables, but not to the documentation';
|
||||
const idea = 'Please review your changes and check if a change needs to be documented!';
|
||||
const message =
|
||||
"Changes were made to the enviroment variables, but not to the documentation";
|
||||
const idea =
|
||||
"Please review your changes and check if a change needs to be documented!";
|
||||
warn(`${message} - <i>${idea}</i>`);
|
||||
}
|
||||
|
||||
|
||||
// CLA alert if first time contributor
|
||||
if(danger.github.pr.author_association === 'FIRST_TIME_CONTRIBUTOR' || danger.github.pr.author_association === 'NONE') {
|
||||
message(`Hello there and welcome to our project!`)
|
||||
message(`By submitting your Pull Request, you acknowledge that you agree with the terms of our [Contributor License Agreement](https://github.com/twentyhq/twenty/blob/main/.github/CLA.md).`)
|
||||
message(`Although we don't have a dedicated legal counsel, having this kind of agreement can protect us from potential legal issues or patent trolls.`)
|
||||
message(`Thank you for your understanding.`)
|
||||
}
|
||||
if (
|
||||
danger.github.pr.author_association === "FIRST_TIME_CONTRIBUTOR" ||
|
||||
danger.github.pr.author_association === "NONE"
|
||||
) {
|
||||
markdown(getMdSection('CLA', `
|
||||
Hello there and welcome to our project!
|
||||
By submitting your Pull Request, you acknowledge that you agree with the terms of our [Contributor License Agreement](https://github.com/twentyhq/twenty/blob/main/.github/CLA.md).
|
||||
Although we don't have a dedicated legal counsel, having this kind of agreement can protect us from potential legal issues or patent trolls.
|
||||
Thank you for your understanding.`))
|
||||
}
|
||||
|
||||
// TODOS / Fixme
|
||||
schedule(todos());
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
"release": "node release.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"danger-plugin-todos": "^1.3.1",
|
||||
"semver": "^7.5.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
||||
@ -308,6 +308,13 @@ core-js@^3.8.2:
|
||||
resolved "https://registry.yarnpkg.com/core-js/-/core-js-3.33.2.tgz#312bbf6996a3a517c04c99b9909cdd27138d1ceb"
|
||||
integrity sha512-XeBzWI6QL3nJQiHmdzbAOiMYqjrb7hwU7A39Qhvd/POSa/t9E1AeZyEZx3fNvp/vtM8zXwhoL0FsiS0hD0pruQ==
|
||||
|
||||
danger-plugin-todos@^1.3.1:
|
||||
version "1.3.1"
|
||||
resolved "https://registry.yarnpkg.com/danger-plugin-todos/-/danger-plugin-todos-1.3.1.tgz#460201ac901ba24eade7c10d51f0a19c5c80612d"
|
||||
integrity sha512-M8/0oo5DV6EyjthIia0ne+yleoZBgO/+lcyH/YDVyY4fKFeiZJMu8TnPQNZ0pt7WeHnbyxImXphsDESHWa+jDA==
|
||||
dependencies:
|
||||
lodash "^4.17.15"
|
||||
|
||||
danger@^11.3.0:
|
||||
version "11.3.0"
|
||||
resolved "https://registry.yarnpkg.com/danger/-/danger-11.3.0.tgz#5a2cbe3e45f367ed0899156c480c7d7e40d90b3d"
|
||||
@ -740,6 +747,11 @@ lodash.once@^4.0.0:
|
||||
resolved "https://registry.yarnpkg.com/lodash.once/-/lodash.once-4.1.1.tgz#0dd3971213c7c56df880977d504c88fb471a97ac"
|
||||
integrity sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==
|
||||
|
||||
lodash@^4.17.15:
|
||||
version "4.17.21"
|
||||
resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c"
|
||||
integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==
|
||||
|
||||
lowercase-keys@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-2.0.0.tgz#2603e78b7b4b0006cbca2fbcc8a3202558ac9479"
|
||||
|
||||
Reference in New Issue
Block a user