ci(danger): add dangerjs for GitHub

Add GitHub workflow for running dangerjs on pull requests.
Add GitHub layout for DangerJS.
This commit is contained in:
Tomas Sebestik
2023-04-19 08:23:49 +02:00
parent 0b5ab48437
commit 7add582eb7
13 changed files with 2358 additions and 0 deletions

19
.github/dangerjs/prDescription.ts vendored Normal file
View File

@@ -0,0 +1,19 @@
import { DangerDSLType, DangerResults } from "danger";
declare const danger: DangerDSLType;
declare const warn: (message: string, results?: DangerResults) => void;
/**
* Check if pull request has has a sufficiently accurate description
*
* @dangerjs WARN
*/
export default function (): void {
const prDescription: string = danger.github.pr.body;
const shortPrDescriptionThreshold: number = 100; // Description is considered too short below this number of characters
if (prDescription.length < shortPrDescriptionThreshold) {
return warn(
"The PR description looks very brief, please check if more details can be added."
);
}
}