// CLA alert if first time contributorif ( danger.github && danger.github.pr && (danger.github.pr.author_association === 'FIRST_TIME_CONTRIBUTOR' || danger.github.pr.author_association === 'NONE')) { markdown( getMdSection( 'Welcome!', `Hello there, congrats on your first PR! We're excited to have you contributing to this 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).`, ), );}
This above code is used to leave a comment in a pr if you make your first pull request to Twenty codebase.
The following image shows how this comment looks like:
// A Dangerfile, in Peril, is evaluated as a script, and so async code does // not work out of the box. By using the `schedule` function you can now // register a section of code to evaluate across multiple tick cycles.// `schedule` currently handles two types of arguments, either a promise // or a function with a resolve arg.schedule(asyncFunction: Scheduleable) => void
Danger is a tool to automate common code review practices. It can run as part of your CI pipeline and help maintain standards. Check out their github repo at danger/danger-js. You can configure it using a dangerfile, which is a javscript or typescript file in the root of your project. It'll post it's results as a comment in the PRs of your project.
// dangerfile.jsimport { schedule } from 'danger'import todos from 'danger-plugin-todos'// Using schedule because this is an async taskschedule(todos())// Optionally provide optionsschedule(todos({ ignore: ['CHANGELOG.md', /test/], // Any files to ignore, can be part of filename or regex pattern to match (default: []) keywords: ['TODO', 'FIXME', 'TO-DO'], // Keywords to find (default: ['TODO', 'FIXME']) repoUrl: 'https://github.com/rohit-gohri/danger-plugin-todos', // If using github provide the repo url (default: true - tries to pick from package.json -> repository.url)}))// For other git providers (that don't follow github style links for files) provide a custom function to turn filepaths into links for the specific commitschedule(todos({ repoUrl: (filepath) => `https://custom-git-example.com/rohit-gohri/danger-plugin-todos/tree/${danger.git.commits[0].sha}/${filepath}`,}))