mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
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).`
|
||
|
);
|
||
|
}
|
||
|
}
|