mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
7add582eb7
Add GitHub workflow for running dangerjs on pull requests. Add GitHub layout for DangerJS.
20 lines
667 B
TypeScript
20 lines
667 B
TypeScript
import { DangerDSLType, DangerResults } from "danger";
|
|
declare const danger: DangerDSLType;
|
|
declare const message: (message: string, results?: DangerResults) => void;
|
|
|
|
/**
|
|
* Check if pull request has not an excessive numbers of commits (if squashed)
|
|
*
|
|
* @dangerjs INFO
|
|
*/
|
|
export default function (): void {
|
|
const tooManyCommitThreshold: number = 2; // above this number of commits, squash commits is suggested
|
|
const prCommits: number = danger.github.commits.length;
|
|
|
|
if (prCommits > tooManyCommitThreshold) {
|
|
return message(
|
|
`You might consider squashing your ${prCommits} commits (simplifying branch history).`
|
|
);
|
|
}
|
|
}
|