mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-16 23:05:38 +00:00
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:
19
.github/dangerjs/prCommitsTooManyCommits.ts
vendored
Normal file
19
.github/dangerjs/prCommitsTooManyCommits.ts
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
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).`
|
||||
);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user